Replies: 1 comment
环境
复现步骤
进程内最小复现(同一个 URL,五种传输对照): const url = 'https://hf-mirror.com/<repo>/resolve/<rev>/tokens.txt';
// A. 已安装出厂策略 dispatcher(线上路径):3xx 被当作最终响应
await fetch(url);
// → status=308, res.url 仍是 hf-mirror.com, res.headers.get('location') === ''
// → 对 huggingface.co/…/resolve/… 同样:status=307
// B. 同一策略 + redirect: 'manual'
await fetch(url, { redirect: 'manual' });
// → status=308, location === '' ← 连手动跟随都拿不到目标
// C. 对照:不安装代理策略
await fetch(url); // → 206,最终 URL 落到 huggingface.co
// D. 对照:用 app 那份 undici@8 自己的 fetch + 它自己的 dispatcher
appUndici.fetch(url, { dispatcher: new appUndici.ProxyAgent({ uri: proxy }) }); // → 206
// E. 把 app 的 undici@8 Agent/ProxyAgent 直接交给内置 fetch
await fetch(url, { dispatcher: new appUndici.Agent() });
// → TypeError: fetch failed — cause: invalid onRequestStart method两个源的 期望 vs 实际
疑似根因
对照 C/D/E 说明问题在版本边界而不是代理本身:同一代理、同一 URL,不装 dispatcher 或用 undici 8 自己的 fetch 都是 206;而把 undici 8 的 Agent 交给内置 fetch 会直接在 影响面
修复建议
临时规避不要把代理变量写进 |
Uh oh!
There was an error while loading. Please reload this page.
按照官方文档《在网络代理后面运行 DSH》把 HTTP_PROXY / HTTPS_PROXY 写进 $DSH_HOME/.env 之后,宿主进程里的 fetch 不再跟随任何 3xx 重定向——响应状态码能到,但 Location 头读不到(redirect: 'manual' 也是空的),于是 3xx 被当成最终响应返回。
直接后果:语音输入插件首次准备模型时下载失败,界面提示 无法下载 model.int8.onnx:下载服务返回 HTTP 308。(下载源
https://hf-mirror.com/
)。任何依赖重定向的宿主 fetch 流程都会同样失败。
All reactions