Replies: 4 comments
|
已定位根因:Chrome 访问 |
|
遇到同样问题的话,最快的临时办法是把地址从 原因不在你这边:Chrome 对回环地址会把 Origin 里的非默认端口剥掉(发出去的 Origin 是 If you hit this, the quick workaround is to open http://localhost:3080/ instead of http://127.0.0.1:3080/. Root cause: Chrome strips the non-default port from the Origin header for loopback addresses, and isTrustedApiRequest compares the ported Host against the port-less Origin; see discussion #1323 for the proposed fix. |
|
Hi, we hit exactly the same issue: Chrome/Chromium strips the port from the Origin header for loopback URLs ( We filed a bug report with the root cause and a suggested fix (compare hostname only, ignore the port): We also maintain a green "double-click to run" launcher distribution that already fixes this with an idempotent patch (Origin check changed to hostname comparison; in LAN mode it also merges the machine's LAN IPs into trustedHosts). Feel free to reference the approach or use it directly:
你好,我们遇到了完全一样的问题:Chrome/Chromium 对回环地址( 同时我们维护的绿色整合版启动器已经解决该问题(自动打幂等补丁:Origin 校验改 hostname 比较,局域网模式自动并入本机局域网 IP),欢迎参考方案或直接使用:
本回复由 AI 辅助撰写 / This reply was drafted with AI assistance. |
|
根因判断一致:Chrome 对 现在还不想改代码的话,把地址换成 English: Same cause as #1323 — Chrome drops the loopback Origin port. Until hostname-only comparison lands, open http://localhost:3080/ instead of http://127.0.0.1:3080/. |
Uh oh!
There was an error while loading. Please reload this page.
在
127.0.0.1:3080选择工作区时,请求被同源校验错误拒绝。复现、预期与验收
@deepseek-ai/dsh@0.1.0-rc.6。dsh web。http://127.0.0.1:3080/。POST /api/host.pickDirectory返回 HTTP 403,界面提示“无法打开文件夹”。Host: 127.0.0.1:3080、Origin: http://127.0.0.1、Sec-Fetch-Site: same-origin。浏览器仍将请求标记为同源,但Origin中的非默认端口被请求链剥离,当前isTrustedApiRequest()按originUrl.host === hostUrl.host比较后拒绝。改用http://localhost:3080/时问题消失。Sec-Fetch-Site: same-origin、Origin 与 Host 主机名完全相同且仅缺少非默认端口时,允许本机 API 请求;same-site跨端口及cross-site请求仍应返回 403。@deepseek-ai/dsh 0.1.0-rc.6。host.pickDirectory请求不再返回 403。Sec-Fetch-Site: same-site的跨端口请求继续返回 403。Sec-Fetch-Site: cross-site的请求继续返回 403。All reactions