{"record":{"id":"89f52fd6b012ba1d","repo":"jdx/mise","slug":"unsupported-relay-destination","errorCode":null,"errorMessage":"unsupported relay destination","messagePattern":"unsupported relay destination","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/github_relay.rs","lineNumber":990,"sourceCode":"            _ = hangup.recv() => Err(crate::request_exit(129)),\n            result = operation => result,\n        }\n    }\n\n    /// API adapter: an HTTP request over the forwarded private socket. No upstream\n    /// authentication headers are sent to the target or supplied by the target.\n    pub(crate) async fn request(\n        socket: &Path,\n        method: Method,\n        url: &Url,\n        headers: &http::HeaderMap,\n    ) -> Result<reqwest::Response> {\n        if url.scheme() != \"https\"\n            || !url.username().is_empty()\n            || url.password().is_some()\n            || url.port().is_some()\n        {\n            bail!(\"unsupported relay destination\");\n        }\n        let prefix = match url.host_str() {\n            Some(\"api.github.com\") => \"api\",\n            Some(\"github.com\") => \"web\",\n            _ => bail!(\"unsupported relay host\"),\n        };\n        let mut relay_url = Url::parse(&format!(\"http://localhost/{prefix}{}\", url.path()))?;\n        relay_url.set_query(url.query());\n        let (client, request_timeout) = adapter_client(socket).await?;\n        let mut req = client.request(method, relay_url);\n        for name in [\"accept\", \"range\", \"if-range\"] {\n            if let Some(value) = headers.get(name) {\n                req = req.header(name, value);\n            }\n        }\n        send_adapter_request(req, request_timeout).await\n    }\n","sourceCodeStart":972,"sourceCodeEnd":1008,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/github_relay.rs#L972-L1008","documentation":"The relay's `request` method only proxies plain HTTPS GitHub URLs: https scheme, no username/password, and no explicit port are required. Any URL violating these constraints is rejected with \"unsupported relay destination\". This keeps the relay from being used as a generic proxy for arbitrary hosts or credentialed endpoints.","triggerScenarios":"Passing an http:// URL (not https) to the relay request path; a URL containing userinfo (user:pass@); a URL with an explicit port (e.g. https://api.github.com:443/); pointing the relay at a non-GitHub host is rejected separately as \"unsupported relay host\".","commonSituations":"Constructing API URLs with an explicit :443 port; embedding a token in the URL userinfo instead of headers; rewriting api.github.com to http in a dev/test environment; a config/env variable overriding the GitHub base URL to something the relay can't proxy.","solutions":["Normalize the URL: use https scheme, drop any :port, and remove userinfo from the URL.","Pass credentials via headers (e.g. Authorization) rather than embedding user:password in the URL.","Only request api.github.com or github.com paths through the relay; route other hosts directly.","Remove any base-URL override env/config (e.g. GITHUB_API_URL style settings) that points at a non-standard endpoint."],"exampleFix":"// before\nlet url = Url::parse(\"https://api.github.com:443/repos/foo/bar\")?;\nrelay_request(&url).await?;\n// after\nlet url = Url::parse(\"https://api.github.com/repos/foo/bar\")?; // no port, no userinfo\nrelay_request(&url).await?;","handlingStrategy":"validation","validationCode":"fn relay_destination_ok(url: &reqwest::Url) -> bool {\n    url.scheme() == \"https\"\n        && url.username().is_empty()\n        && url.password().is_none()\n        && url.port().is_none()\n}","typeGuard":null,"tryCatchPattern":"if !relay_destination_ok(&url) {\n    return Err(anyhow!(\"URL must be https, credential-free, and portless for the relay\"));\n}","preventionTips":["Normalize GitHub URLs: https only, strip :443 and any userinfo","Send credentials in headers, never in the URL","Don't override the GitHub base URL with a non-standard endpoint when using the relay"],"tags":["http","url","github","proxy","validation"],"backgroundTag":"invalid-url-format","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}