{"record":{"id":"c9b03e038461f7d8","repo":"risingwavelabs/risingwave","slug":"can-t-get-doris-be-url-in-header","errorCode":null,"errorMessage":"Can't get doris BE url in header","messagePattern":"Can't get doris BE url in header","errorType":"exception","errorClass":"SinkError","httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/doris_starrocks_connector.rs","lineNumber":192,"sourceCode":"    pub fn build(self) -> HashMap<String, String> {\n        self.header\n    }\n}\n\n/// Try getting BE url from a redirected response, returning `Ok(None)` indicates this request does\n/// not redirect.\n///\n/// The reason we handle the redirection manually is that if we let `reqwest` handle the redirection\n/// automatically, it will remove sensitive headers (such as Authorization) during the redirection,\n/// and there's no way to prevent this behavior.\nfn try_get_be_url(resp: &Response, fe_host: &str) -> Result<Option<Url>> {\n    match resp.status() {\n        StatusCode::TEMPORARY_REDIRECT => {\n            let be_url = resp\n                .headers()\n                .get(\"location\")\n                .ok_or_else(|| {\n                    SinkError::DorisStarrocksConnect(anyhow!(\"Can't get doris BE url in header\",))\n                })?\n                .to_str()\n                .context(\"Can't get doris BE url in header\")\n                .map_err(SinkError::DorisStarrocksConnect)?\n                .to_owned();\n\n            let mut parsed_be_url = Url::parse(&be_url)\n                .map_err(|err| SinkError::DorisStarrocksConnect(anyhow!(err)))?;\n\n            if fe_host != LOCALHOST && fe_host != LOCALHOST_IP {\n                let be_host = parsed_be_url.host_str().ok_or_else(|| {\n                    SinkError::DorisStarrocksConnect(anyhow!(\"Can't get be host from url\"))\n                })?;\n\n                if be_host == LOCALHOST || be_host == LOCALHOST_IP {\n                    // if be host is 127.0.0.1, we may can't connect to it directly,\n                    // so replace it with fe host\n                    parsed_be_url","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/doris_starrocks_connector.rs#L174-L210","documentation":"Doris stream load uses a two-step redirect: the FE answers 307 TEMPORARY_REDIRECT with the BE URL in the `location` header. If a 307 arrives without that header, or the header value is not valid UTF-8, try_get_be_url raises this error because the actual BE endpoint cannot be determined.","triggerScenarios":"Receiving HTTP 307 from the Doris FE with no `location` header, or a non-ASCII/non-UTF-8 location value, during send_stream_load_request or connector build.","commonSituations":"Misconfigured proxy/load balancer stripping the Location header; malformed FE redirect responses; non-ASCII hostnames in the cluster.","solutions":["Check any proxy/LB between RisingWave and Doris FE preserves the Location header on 307 responses.","Verify the Doris FE is healthy and reachable directly (bypass proxies).","Inspect the raw response headers with curl -v against the stream-load endpoint.","Upgrade Doris if the FE is known to emit broken redirects."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match send_stream_load_request(&mut req).await {\n    Err(SinkError::DorisStarrocksConnect(e)) if e.to_string().contains(\"Can't get doris BE url in header\") => {\n        eprintln!(\"FE sent 307 without a usable Location header; check proxies\");\n    }\n    other => other?,\n}","preventionTips":["Ensure proxies/LBs preserve the Location header on 307 responses.","Point the sink directly at the Doris FE when possible.","Test with `curl -v -X PUT` against the stream-load endpoint to inspect redirects."],"tags":["rust","sink","doris","http","redirect"],"backgroundTag":"http-error-response","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}