NETWORK ROUTING
播放线路
自选 Cloudflare 反代 IP。只填写 IP,端口固定为 443;线路列表仅保存在当前浏览器。
当前选择:默认线路(Cloudflare 自动)
默认使用 Cloudflare 自动线路。
自选 IP 怎样真正生效?(一次性 Cloudflare 设置)
Cloudflare 会过滤 Worker 直接返回的 Alt-Svc。这四条规则只在用户自己的橙云域名上配置。浏览器通过一次同源请求把 IP 交给 Worker;Worker 先校验 IP,再将合法值写入内部响应头 X-BXG-Alt-IP,Cloudflare 规则读取该已校验响应头生成 Alt-Svc,最后一条规则删除这个内部头。workers.dev 和 pages.dev 默认域名不能配置这类 Zone 规则。
- IPv4:匹配
(http.host eq "YOUR_HOSTNAME" and http.request.uri.path eq "/api/v1/route" and len(http.response.headers["x-bxg-alt-ip"][0]) gt 0 and http.response.headers["x-bxg-alt-ip"][0] ne "auto" and not (http.response.headers["x-bxg-alt-ip"][0] contains ":"));响应头 Alt-Svc 选择 Set dynamic;值 concat("h2=\"", http.response.headers["x-bxg-alt-ip"][0], ":443\"; ma=300")。
- IPv6:匹配
(http.host eq "YOUR_HOSTNAME" and http.request.uri.path eq "/api/v1/route" and http.response.headers["x-bxg-alt-ip"][0] contains ":");响应头 Alt-Svc 选择 Set dynamic;值 concat("h2=\"[", http.response.headers["x-bxg-alt-ip"][0], "]:443\"; ma=300")。
- 恢复默认:匹配
(http.host eq "YOUR_HOSTNAME" and http.request.uri.path eq "/api/v1/route" and http.response.headers["x-bxg-alt-ip"][0] eq "auto");响应头 Alt-Svc 选择 Set static;值 clear。
- 清理内部头:匹配
(http.host eq "YOUR_HOSTNAME" and http.request.uri.path eq "/api/v1/route");响应头名称 X-BXG-Alt-IP;操作选择 Remove。
把四处 YOUR_HOSTNAME 替换成实际自定义域名。原始 IP 只通过同源请求发给 Worker,线路列表仍只保存在本机。浏览器只会在建立新连接时尝试切换,正在使用的连接不会被强制中断。反代 IP 还必须能以原网页域名完成 TLS/SNI 验证并支持 HTTP/2。