{"record":{"id":"b9f68cc122c6128b","repo":"DioxusLabs/dioxus","slug":"http-handshake-failed-e","errorCode":null,"errorMessage":"HTTP handshake failed: {e}","messagePattern":"HTTP handshake failed: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"packages/cli/src/serve/proxy.rs","lineNumber":59,"sourceCode":"                if start.elapsed() >= max_wait {\n                    return Err(handle_error(anyhow::anyhow!(\n                        \"Backend not ready after {max_wait:?}: {e}\"\n                    )));\n                }\n                tracing::debug!(\"Backend not ready, retrying in {backoff:?}...\");\n                tokio::time::sleep(backoff).await;\n                backoff = (backoff * 2).min(std::time::Duration::from_secs(2));\n            }\n        }\n    };\n\n    // Wrap the TCP stream for hyper\n    let io = TokioIo::new(stream);\n\n    // Perform HTTP/1.1 handshake on the same connection\n    let (mut sender, conn) = http1::handshake(io)\n        .await\n        .map_err(|e| handle_error(anyhow::anyhow!(\"HTTP handshake failed: {e}\")))?;\n\n    // Spawn connection driver to keep it alive\n    tokio::spawn(async move {\n        if let Err(e) = conn.await {\n            tracing::debug!(\"Connection closed: {e}\");\n        }\n    });\n\n    // Send request through the established connection (streaming body)\n    sender\n        .send_request(req)\n        .await\n        .map_err(|e| handle_error(anyhow::anyhow!(\"Request failed: {e}\")))\n}\n\n/// Add routes to the router handling the specified proxy config.\n///\n/// We will proxy requests directed at either:","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/fda3dc9c2b10ddf4417edcbb98caa9613ac92d26/packages/cli/src/serve/proxy.rs#L41-L77","documentation":"Raised in send_with_retry (called from proxy_to) when the TCP connection to the backend succeeded but the hyper http1::handshake over that stream failed. This means the peer accepted the socket yet did not complete a valid HTTP/1.1 exchange (not an HTTP server, TLS mismatch, or connection reset) — the error is mapped through the proxy's handle_error callback into an HTTP error response.","triggerScenarios":"Thrown at packages/cli/src/serve/proxy.rs:59 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The HTTP handshake with the proxy backend failed. Verify the backend URL, protocol, and TLS configuration."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fda3dc9c2b10ddf4417edcbb98caa9613ac92d26","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}