BigPizzaV3/CodexPlusPlus · error · anyhow::Error
Base URL 必须使用 HTTPS
Error message
Base URL 必须使用 HTTPS
What it means
validate_llm_proxy_url parses the user-supplied Base URL and requires scheme https. This is an SSRF/transport-security guard: the proxy will send the caller's body and any configured key over this URL, so plaintext http is rejected outright after URL-parse validation.
Solutions
- Change the Base URL to https://...
- Run a local HTTPS terminator (reverse proxy with TLS) if the upstream only speaks HTTP
- Verify the URL string includes the scheme, e.g. "https://host" not "host"
Example fix
// before
let url = validate_llm_proxy_url("http://api.openai.com/v1")?;
// after
let url = validate_llm_proxy_url("https://api.openai.com/v1")?; Defensive patterns
Strategy: validation
Validate before calling
fn base_url_is_https(raw: &str) -> bool {
reqwest::Url::parse(raw.trim()).map(|u| u.scheme() == "https").unwrap_or(false)
} Prevention
- Always include the https:// scheme in configured Base URLs
- Validate URL scheme at config-entry time in the UI, not just at request time
- Never paste scheme-less hostnames into Base URL fields
When it happens
Trigger: Calling llm_proxy_value with a Base URL string whose parsed scheme is not "https", e.g. "http://api.example.com".
Common situations: Using a plain-HTTP local or test endpoint, forgetting the scheme entirely ("api.example.com" parses as a relative URL), or pasting an internal http:// address.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
- API 地址须使用 HTTPS,且不含账号、密码、查询参数或片段
- API 地址须使用 HTTPS,且不含账号、密码、查询参数或片段
- 链接缺少解密密钥。请使用完整的分享链接。
- Base URL 不能为空
- 上游 Base URL 不能为空
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/425999b973682a9c.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/routes.rs:787
{
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 b1ed92e5e4)