{"record":{"id":"ea7264c1545185fc","repo":"jdx/mise","slug":"remote-cache-url-must-use-https-except-for-loopbac","errorCode":null,"errorMessage":"remote cache URL must use HTTPS except for loopback development servers","messagePattern":"remote cache URL must use HTTPS except for loopback development servers","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mise-cache-core/src/lib.rs","lineNumber":1120,"sourceCode":"    } else {\n        bail!(\"GitHub Actions OIDC request URL must use HTTPS\")\n    }\n}\n\nfn validate_remote_url(base_url: &Url, authenticated: bool) -> Result<()> {\n    if base_url.scheme() == \"https\" {\n        return Ok(());\n    }\n    if base_url.scheme() != \"http\" {\n        bail!(\"remote cache URL must use HTTPS\");\n    }\n    let is_loopback = base_url.host().is_some_and(|host| match host {\n        Host::Domain(host) => host.eq_ignore_ascii_case(\"localhost\"),\n        Host::Ipv4(address) => address.is_loopback(),\n        Host::Ipv6(address) => address.is_loopback(),\n    });\n    if !is_loopback && authenticated {\n        bail!(\"remote cache URL must use HTTPS except for loopback development servers\");\n    }\n    if !is_loopback {\n        warn!(\n            \"using an unauthenticated remote build cache over plain HTTP; cache traffic can be read \\\n             or modified in transit\"\n        );\n    }\n    Ok(())\n}\n\nfn normalized_base_url(mut url: Url) -> Url {\n    if !url.path().ends_with('/') {\n        url.set_path(&format!(\"{}/\", url.path()));\n    }\n    url\n}\n\nfn retry_delays(retries: i64) -> impl Iterator<Item = Duration> {","sourceCodeStart":1102,"sourceCodeEnd":1138,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/crates/mise-cache-core/src/lib.rs#L1102-L1138","documentation":"Plain-HTTP cache URLs are only allowed for loopback development servers (localhost, 127.0.0.0/8, ::1). When the connection is authenticated (credentials would be sent) and the host is not loopback, the client refuses to proceed instead of leaking credentials over plaintext. Unauthenticated non-loopback HTTP only produces a warning.","triggerScenarios":"validate_remote_url called with authenticated=true, scheme \"http\", and a non-loopback host — e.g. http://cache.internal.example.com with credentials configured.","commonSituations":"Self-hosted cache server on the LAN configured over HTTP with an auth token, Docker/internal-network hostnames (not localhost) with credentials, missing TLS on a production cache deployment.","solutions":["Enable TLS on the cache server and switch the URL to https://","If it truly is a local dev server, use http://localhost:<port> or 127.0.0.1 which is exempt","Drop the credentials if the cache is intentionally public/unauthenticated (this degrades to a warning, but prefer HTTPS)","Terminate TLS at a reverse proxy in front of the cache"],"exampleFix":"// before\nMISE_CACHE_REMOTE_URL=http://cache.internal.example.com\nMISE_CACHE_REMOTE_AUTH_TOKEN=secret\n// after\nMISE_CACHE_REMOTE_URL=https://cache.internal.example.com\nMISE_CACHE_REMOTE_AUTH_TOKEN=secret","handlingStrategy":"validation","validationCode":"let url = Url::parse(cache_url)?;\nlet loopback = url.host().is_some_and(|h| match h {\n    url::Host::Domain(d) => d.eq_ignore_ascii_case(\"localhost\"),\n    url::Host::Ipv4(a) => a.is_loopback(),\n    url::Host::Ipv6(a) => a.is_loopback(),\n});\nif url.scheme() == \"http\" && authenticated && !loopback {\n    return Err(\"configure HTTPS for authenticated remote cache\".into());\n}","typeGuard":"fn allows_plain_http(url: &Url, authenticated: bool) -> bool {\n    url.scheme() != \"http\" || !authenticated || url.host_str()\n        .map(|h| h == \"localhost\" || h.starts_with(\"127.\"))\n        .unwrap_or(false)\n}","tryCatchPattern":"match validate_remote_url(&url, true) {\n    Err(e) if e.to_string().contains(\"loopback\") => {\n        eprintln!(\"enable TLS on the cache server or use localhost for dev\");\n    }\n    other => other,\n}","preventionTips":["Always terminate TLS at production cache deployments","Use localhost/127.0.0.1 for local dev caches","Never send auth tokens over LAN plain HTTP"],"tags":["remote-cache","https","security","config"],"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"}