jdx/mise · error

remote cache URL must use HTTPS except for loopback…

Error message

remote cache URL must use HTTPS except for loopback development servers

What it means

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.

Solutions

  1. Enable TLS on the cache server and switch the URL to https://
  2. If it truly is a local dev server, use http://localhost:<port> or 127.0.0.1 which is exempt
  3. Drop the credentials if the cache is intentionally public/unauthenticated (this degrades to a warning, but prefer HTTPS)
  4. Terminate TLS at a reverse proxy in front of the cache

Example fix

// before
MISE_CACHE_REMOTE_URL=http://cache.internal.example.com
MISE_CACHE_REMOTE_AUTH_TOKEN=secret
// after
MISE_CACHE_REMOTE_URL=https://cache.internal.example.com
MISE_CACHE_REMOTE_AUTH_TOKEN=secret
Defensive patterns

Strategy: validation

Validate before calling

let url = Url::parse(cache_url)?;
let loopback = url.host().is_some_and(|h| match h {
    url::Host::Domain(d) => d.eq_ignore_ascii_case("localhost"),
    url::Host::Ipv4(a) => a.is_loopback(),
    url::Host::Ipv6(a) => a.is_loopback(),
});
if url.scheme() == "http" && authenticated && !loopback {
    return Err("configure HTTPS for authenticated remote cache".into());
}

Type guard

fn allows_plain_http(url: &Url, authenticated: bool) -> bool {
    url.scheme() != "http" || !authenticated || url.host_str()
        .map(|h| h == "localhost" || h.starts_with("127."))
        .unwrap_or(false)
}

Try / catch

match validate_remote_url(&url, true) {
    Err(e) if e.to_string().contains("loopback") => {
        eprintln!("enable TLS on the cache server or use localhost for dev");
    }
    other => other,
}

Prevention

When it happens

Trigger: validate_remote_url called with authenticated=true, scheme "http", and a non-loopback host — e.g. http://cache.internal.example.com with credentials configured.

Common situations: 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.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/ea7264c1545185fc. Report an issue: GitHub.

Appendix: source

Thrown at crates/mise-cache-core/src/lib.rs:1120

    } else {
        bail!("GitHub Actions OIDC request URL must use HTTPS")
    }
}

fn validate_remote_url(base_url: &Url, authenticated: bool) -> Result<()> {
    if base_url.scheme() == "https" {
        return Ok(());
    }
    if base_url.scheme() != "http" {
        bail!("remote cache URL must use HTTPS");
    }
    let is_loopback = base_url.host().is_some_and(|host| match host {
        Host::Domain(host) => host.eq_ignore_ascii_case("localhost"),
        Host::Ipv4(address) => address.is_loopback(),
        Host::Ipv6(address) => address.is_loopback(),
    });
    if !is_loopback && authenticated {
        bail!("remote cache URL must use HTTPS except for loopback development servers");
    }
    if !is_loopback {
        warn!(
            "using an unauthenticated remote build cache over plain HTTP; cache traffic can be read \
             or modified in transit"
        );
    }
    Ok(())
}

fn normalized_base_url(mut url: Url) -> Url {
    if !url.path().ends_with('/') {
        url.set_path(&format!("{}/", url.path()));
    }
    url
}

fn retry_delays(retries: i64) -> impl Iterator<Item = Duration> {

View on GitHub (pinned to 533346cc37)