调试 Url-Shorten-Worker API报错 from origin 'null' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.

问题 

想调试 Url-Shorten-Worker, 把 index.html 保存在本地电脑上, 调用服务器https://1way.eu.org/的API, 报错

Access to fetch at 'https://1way.eu.org/bodongshouqulveweifengci' from origin 'null' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.

问GPT



答案

在 worker 的 js 中增加如下:

评论

The Hot3 in Last 7 Days

用 Cloudflare worker 抓取 喷嚏网 浮世汇 生成 RSS

极简一键脚本 搭NaiveProxy梯子 自定义端口 与Caddy V2前置的VLESS/Vmess V2Ray共存 可开CDN

安装OmniRoute 白嫖免费模型oc/deepseek-v4-flash-free 在 甲骨文Oracle ARM VPS Ubuntu系统 用非root用户 不用sudo -i by Hermes 对接 tencent/hy3:free