(简体中文) 任何地方都是节点JS反向代理,在代理请求中添加了CORS头.
** CORS Anywhere**是一个节点JS代理,在代理请求中添加了CORS头.
url到代理的字面意思是从路径取出,验证和代理. 协议 部分代理URI是可选的,默认为"http". 如果指定端口443, 协议默认为“ https ”。
此软件包不限制 http 方法或标题, 除非 饼干。 拒绝请求[用户资 (http://www.w3.org/TR/cors/#user-credentials). 应用程序可以配置为代理请求需要一个标题, 例如避免 浏览器的直接访问。
□ 实例
(原始内容存档于2019-09-29) (英语). ```javascript // Listen on a specific host via the HOST environment variable var host = process.env.HOST || '0.0.0.0'; // Listen on a specific port via the PORT environment variable var port = process.env.PORT || 8080;
var cors_proxy = require('cors-anywhere'); cors_proxy.createServer({ originWhitelist: [], // Allow all origins requireHeader: ['origin', 'x-requested-with'], removeHeaders: ['cookie', 'cookie2'] }).listen(port, host, function() { console.log('Running CORS Anywhere on ' + host + ':' + port); });
请举例说明:
* “http://localhost:8080/http://google.com/`-Google.
* `http://localhost:8080/google.com`-与以前相同。
* “ZZURL3Z-代理”
* `http://localhost:8080/`-显示用法文本,定义见`lib/help.txt'
*`http://localhost:8080/favicon.ico`-答复404 未找到
现场实例:
* https://cors-anywhere.herokuapp.com/(英语:
* https://robwu.nl/cors-anywhere.html - 本演示演示如何使用API.
□ 文档
QQ 客户端
要使用 API,只需将 URL 与 API URL 前置. 举个例子看看[demo.html](demo.html).
文件简明摘要见[lib/help.txt] (lib/help.txt).
** 注:截至2021年2月,进入演示服务器需要选入**,
见:ZZURL9Z
如果您想要在需要时自动启用跨域请求, 请使用以下片段 :
ZZ1ZZ
如果使用jQuery,也可以使用以下代码来代替**previPS: 公共演示服务器 (cors-anywhere.herokuapp.com) 将在 2021 年 1 月 31 日前受到极大限制
某些 URL 会导致服务崩溃
CVE-2020-36851: 未修补: 全面 SSRF: 代理不阻止 RFC 1918 IP 范围以及 Cloud IDMS
是否在文档中添加安全部分?
在自己的 cors-anywhere 服务器中出现 403 错误
允许 npx
Firebase 上的 POST 问题
已过时
未找到,原因是代理错误: AggregateError
API 域名解析问题