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

酒馆SillyTavern 玩英文角色卡 也能以中文输出 设置世界书Lorebooks

搭 Docker版 Sub-Store 带 http-meta 实现 集合订阅 测延迟 排序 筛选 生成新订阅 定时任务上传Gist

酒馆SillyTavern 用中文讲故事 修改角色卡 修改AI生成的历史记录