DioxusLabs/dioxus · error

Request failed

Error message

Request failed: {e}

What it means

Raised in send_with_retry (called from proxy_to) when the established hyper connection's sender fails to send the proxied request to the backend. This means the handshake succeeded but the request could not be delivered — connection closed mid-request or protocol violation — and, like the handshake failure, it is converted via handle_error into an HTTP error response for the client.

Solutions

  1. The proxied request failed. Check that the backend is reachable and read its logs.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/cli/src/serve/proxy.rs:72 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@fda3dc9c2b (2026-08-23). Data as JSON: /api/errors/282c93822bb7c61d. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/serve/proxy.rs:72

    let io = TokioIo::new(stream);

    // Perform HTTP/1.1 handshake on the same connection
    let (mut sender, conn) = http1::handshake(io)
        .await
        .map_err(|e| handle_error(anyhow::anyhow!("HTTP handshake failed: {e}")))?;

    // Spawn connection driver to keep it alive
    tokio::spawn(async move {
        if let Err(e) = conn.await {
            tracing::debug!("Connection closed: {e}");
        }
    });

    // Send request through the established connection (streaming body)
    sender
        .send_request(req)
        .await
        .map_err(|e| handle_error(anyhow::anyhow!("Request failed: {e}")))
}

/// Add routes to the router handling the specified proxy config.
///
/// We will proxy requests directed at either:
///
/// - the exact path of the proxy config's backend URL, e.g. /api
/// - the exact path with a trailing slash, e.g. /api/
/// - any subpath of the backend URL, e.g. /api/foo/bar
pub(crate) fn add_proxy(mut router: Router, proxy: &WebProxyConfig) -> Result<Router> {
    let url: Uri = proxy.backend.parse()?;
    let path = url.path().to_string();
    let trimmed_path = path.trim_start_matches('/');

    if trimmed_path.is_empty() {
        bail!(
            "Proxy backend URL must have a non-empty path, e.g. {}/api instead of {}",
            proxy.backend.trim_end_matches('/'),

View on GitHub (pinned to fda3dc9c2b)