BigPizzaV3/CodexPlusPlus · error · anyhow::Error
Base URL 不得指向本机或私有网络
Error message
Base URL 不得指向本机或私有网络
What it means
Thrown by validate_llm_proxy_url when the URL's host is in the blocked set — loopback, private-network, or link-local addresses (is_blocked_llm_proxy_host). This is an SSRF guard keeping the bridge proxy from reaching the local machine or internal network; the offending input is the payload url whose host resolves to a blocked address, and the check runs after scheme/credential validation.
Source
Thrown at crates/codex-plus-core/src/routes.rs:780
"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(']')
.to_lowercase();
if host.is_empty()
|| host == "localhost"
|| host.ends_with(".localhost")
|| host.ends_with(".local")
{
return true;
}
if let Ok(ip) = std::net::IpAddr::from_str(&host) {View on GitHub (pinned to f2074595a2)
Solutions
- 使用公网可达的 LLM 服务地址
- 不要用 localhost、127.0.0.1、内网 IP 或 *.local 域名
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/codex-plus-core/src/routes.rs:780 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/72e6e1c9eb7c12bc.
Report an issue: GitHub.