fix: prevent [No Host] panel errors behind CDN or missing Host header

Force nginx to pass the domain as Host, add PANEL_DOMAIN fallback in Flask,
and document that the admin panel must be accessed over HTTP not HTTPS.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-16 10:28:00 +08:00
parent 6d82c7eb07
commit ba361eb5b8
5 changed files with 57 additions and 3 deletions
+29
View File
@@ -36,6 +36,8 @@ curl -I "http://66.hyf2.cc/$(grep ^PANEL_PATH= /opt/jiedian/.env | cut -d= -f2)/
```
> 443 端口已被 sing-box Reality 占用,面板走 80 端口子路径。请妥善保管 `PANEL_PATH`,相当于隐藏入口。
>
> **必须用 `http://` 访问,不要用 `https://`。** 443 不是 Web 面板,用 HTTPS 会报错或出现 `Invalid URL / [No Host]`。
面板可查看每个节点的 **在线状态、连接数、实时速率、累计流量**(数据来自 sing-box Clash API,仅监听 127.0.0.1)。
@@ -45,6 +47,33 @@ curl -I "http://66.hyf2.cc/$(grep ^PANEL_PATH= /opt/jiedian/.env | cut -d= -f2)/
## 常见问题
### 面板报 Invalid URL / [No Host]
**原因**:用了 `https://域名/面板路径/` 访问,或域名开了 CDN 加速但回源 Host 未配置。
- 443 端口是 **sing-box Reality**,不是 Web 面板
- 面板地址必须是:**`http://66.hyf2.cc/jiedian-xxxx/`**(注意是 **http**
**处理**
```bash
# 1. 用 HTTP 打开(把 jiedian-xxxx 换成你的 PANEL_PATH
http://66.hyf2.cc/jiedian-xxxx/
# 2. VPS 上更新 nginx 与面板(修复 Host 头)
cd /opt/jiedian
git pull
sed -e "s|__DOMAIN__|$(grep ^DOMAIN= .env | cut -d= -f2)|g" \
-e "s|__PANEL_LOCATION__|/$(grep ^PANEL_PATH= .env | cut -d= -f2)/|g" \
-e "s|__PANEL_PREFIX__|/$(grep ^PANEL_PATH= .env | cut -d= -f2)|g" \
-e "s|__PANEL_ALLOW__||g" \
server/nginx/acme.conf.template > /etc/nginx/sites-available/acme
nginx -t && systemctl reload nginx
systemctl restart jiedian-panel
```
若域名在阿里云/Cloudflare 开了 **CDN 代理**,建议对管理域名 **关闭 CDN**(仅 DNS 解析到 VPS),否则 80 端口回源也可能异常。
### sing-box 报错 v2ray api is not included in this build
GitHub 下载的官方 sing-box **默认不带** `v2ray_api` 模块。若配置里写了 `experimental.v2ray_api`,启动时会直接失败: