node.js - 获取 Gists 的 Cors 选项

标签 node.js express cross-origin-read-blocking

我试图用 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/

相关文章:

javascript - 即使设置了 %PYTHON%,Node.js (npm) 也拒绝找到 python

javascript - 通过 module.exports 发送多个函数抛出错误

javascript - 使用 postman Express 发送带有原始 json 的 POST 数据

templates - 比较 Mongoose 对象 ID 时,if 语句在 Jade 中不起作用

javascript - 如何配置 Travis CI 以在没有测试的情况下构建 Node.js?

javascript - Electron 无边框窗口在窗口未聚焦时显示标题栏

google-chrome - 在 Chrome 73 中阻止的 CORB 选项请求

google-chrome-extension - 如何避免 Chrome Web 扩展中的跨源读取阻止 (CORB)

node.js - 除 meteor 和 meteor 束的主要区别是什么?

node.js - 不存在 'Access-Control-Allow-Origin' header .. Angular 7 和 Express