我试图用 github 脚本嵌入我的要点。我有一个 NodeJS ExpressJS 应用程序,创建一个静态页面并粘贴由 github.gist 生成的脚本标签。现在我得到一个错误:
my-website:35 Cross-Origin Read Blocking (CORB) blocked cross-origin response https://gist.github.com/PinkyRabbit/7f2db625ae53d799b5ecc4b710c65644 with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.
我试图通过 cors module 允许 cors ,但即使我使用默认设置为所有域打开 cors cors()
- 没有任何改变,github.gists 仍然被阻止。
最佳答案
Gist 似乎在 RawGit 上受 CORS 支持
curl -I https://raw.githack.com/gist/Rapptz/c4324f17a80c94776832430007ad40e6/raw/c92df8492be3679635dee0e80273b2ffb6a64cbf/dpy_development_plans.md
HTTP/1.1 200 OK
Date: Sun, 06 Mar 2022 06:56:13 GMT
Content-Type: text/markdown; charset=utf-8
...
Access-Control-Allow-Origin: *
虽然有很多问题,请仔细阅读链接。
关于node.js - 获取 Gists 的 Cors 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65549117/