{"record":{"id":"3d1ccdf6e25ee162","repo":"astral-sh/uv","slug":"invalid-http-status-location-value-redirect","errorCode":null,"errorMessage":"Invalid HTTP {status} 'Location' value `{redirect_url}`: scheme needs to be https or http","messagePattern":"Invalid HTTP (.+?) 'Location' value `(.+?)`: scheme needs to be https or http","errorType":"http","errorClass":"reqwest_middleware::Error","httpStatus":null,"severity":"error","filePath":"crates/uv-client/src/base_client.rs","lineNumber":1030,"sourceCode":"            return Err(reqwest_middleware::Error::Middleware(anyhow!(\n                \"Invalid HTTP {status} 'Location' value `{location}`: {err}\"\n            )));\n        }\n    };\n    // Per RFC 7231, fragments must be propagated\n    if let Some(fragment) = original_req_url.fragment() {\n        redirect_url.set_fragment(Some(fragment));\n    }\n\n    // Ensure the URL is a valid HTTP URI.\n    if let Err(err) = redirect_url.as_str().parse::<http::Uri>() {\n        return Err(reqwest_middleware::Error::Middleware(anyhow!(\n            \"HTTP {status} 'Location' value `{redirect_url}` is not a valid HTTP URI: {err}\"\n        )));\n    }\n\n    if redirect_url.scheme() != \"http\" && redirect_url.scheme() != \"https\" {\n        return Err(reqwest_middleware::Error::Middleware(anyhow!(\n            \"Invalid HTTP {status} 'Location' value `{redirect_url}`: scheme needs to be https or http\"\n        )));\n    }\n\n    let mut headers = HeaderMap::new();\n    std::mem::swap(req.headers_mut(), &mut headers);\n\n    let cross_host = redirect_url.host_str() != original_req_url.host_str()\n        || redirect_url.port_or_known_default() != original_req_url.port_or_known_default();\n    if cross_host {\n        if cross_origin_credentials_policy == CrossOriginCredentialsPolicy::Secure {\n            debug!(\"Received a cross-origin redirect. Removing sensitive headers.\");\n            headers.remove(AUTHORIZATION);\n            headers.remove(COOKIE);\n            headers.remove(PROXY_AUTHORIZATION);\n            headers.remove(WWW_AUTHENTICATE);\n        }\n    // If the redirect request is not a cross-origin request and the original request already","sourceCodeStart":1012,"sourceCodeEnd":1048,"githubUrl":"https://github.com/astral-sh/uv/blob/f1a42680ff5272232d65748acf338b19778dde24/crates/uv-client/src/base_client.rs#L1012-L1048","documentation":"Error \"Invalid HTTP {status} 'Location' value `{redirect_url}`: scheme needs to be https or http\" thrown in astral-sh/uv.","triggerScenarios":"Thrown at crates/uv-client/src/base_client.rs:1030 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f1a42680ff5272232d65748acf338b19778dde24","analyzedAt":"2026-08-16T04:51:47.599Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}