{"record":{"id":"9993c476df927b43","repo":"DioxusLabs/dioxus","slug":"proxy-backend-url-must-have-a-non-empty-path-e-g","errorCode":null,"errorMessage":"Proxy backend URL must have a non-empty path, e.g. {}/api instead of {}","messagePattern":"Proxy backend URL must have a non-empty path, e\\.g\\. (.+?)/api instead of (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/serve/proxy.rs","lineNumber":88,"sourceCode":"        .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:\n///\n/// - the exact path of the proxy config's backend URL, e.g. /api\n/// - the exact path with a trailing slash, e.g. /api/\n/// - any subpath of the backend URL, e.g. /api/foo/bar\npub(crate) fn add_proxy(mut router: Router, proxy: &WebProxyConfig) -> Result<Router> {\n    let url: Uri = proxy.backend.parse()?;\n    let path = url.path().to_string();\n    let trimmed_path = path.trim_start_matches('/');\n\n    if trimmed_path.is_empty() {\n        bail!(\n            \"Proxy backend URL must have a non-empty path, e.g. {}/api instead of {}\",\n            proxy.backend.trim_end_matches('/'),\n            proxy.backend\n        );\n    }\n\n    let method_router = proxy_to(url, false, handle_proxy_error);\n\n    // api/*path\n    router = router.route(\n        &format!(\"/{}/{{*path}}\", trimmed_path.trim_end_matches('/')),\n        method_router.clone(),\n    );\n\n    // /api/\n    router = router.route(\n        &format!(\"/{}/\", trimmed_path.trim_end_matches('/')),\n        method_router.clone(),","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/cli/src/serve/proxy.rs#L70-L106","documentation":"Configuration guard in add_proxy: the proxy backend URL parsed from Dioxus.toml's web proxy config has an empty path component, so there is no route prefix (like /api) to register proxy routes for. The inputs at fault are the configured backend URL and the suggested non-empty-path alternative shown in the message.","triggerScenarios":"Thrown at packages/cli/src/serve/proxy.rs:88 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Give the proxy backend URL a non-empty path, e.g. http://localhost:8080/api."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}