调试 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

白嫖worker 自建短链服务 Url-Shorten-Worker 变身文件保管站 File Storage 保存到 R2对象存储

白嫖worker 自建短链服务 Url-Shorten-Worker 变身文件保管站 File Storage 保存到 R2对象存储 搭建手册

Woiden IPv6 VPS 搭 V2ray 梯子 VLESS+Websocket+TLS 模式 免费 白嫖 全程手机操作 2022-4-19