BigPizzaV3/CodexPlusPlus · error · anyhow::Error

Base URL 必须使用 HTTPS

Error message

Base URL 必须使用 HTTPS

What it means

Thrown by validate_llm_proxy_url when the parsed Base URL's scheme is not https. The LLM Bridge proxy only forwards to TLS-protected endpoints since request bodies carry prompts and credentials; the offending input is the url field of the bridge payload, rejected after a successful URL parse but before any host checks.

Source

Thrown at crates/codex-plus-core/src/routes.rs:771

    {
        serde_json::from_slice::<Value>(&bytes).ok()
    } else {
        None
    };

    Ok(json!({
        "status": "ok",
        "http_status": http_status,
        "ok": ok,
        "body_text": body_text,
        "body_json": body_json,
    }))
}

fn validate_llm_proxy_url(raw: &str) -> anyhow::Result<reqwest::Url> {
    let url = reqwest::Url::parse(raw.trim()).map_err(|_| anyhow::anyhow!("Base URL 格式无效"))?;
    if url.scheme() != "https" {
        anyhow::bail!("Base URL 必须使用 HTTPS");
    }
    if !url.username().is_empty() || url.password().is_some() {
        anyhow::bail!("Base URL 不得包含用户名或密码");
    }
    let host = url
        .host_str()
        .ok_or_else(|| anyhow::anyhow!("Base URL 缺少主机名"))?;
    if is_blocked_llm_proxy_host(host) {
        anyhow::bail!("Base URL 不得指向本机或私有网络");
    }
    Ok(url)
}

fn is_blocked_llm_proxy_host(host: &str) -> bool {
    let host = host
        .trim()
        .trim_start_matches('[')
        .trim_end_matches(']')

View on GitHub (pinned to f2074595a2)

Solutions

  1. 改用 https:// 开头的 Base URL
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/codex-plus-core/src/routes.rs:771 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23). Data as JSON: /api/errors/425999b973682a9c. Report an issue: GitHub.