本站有一些RSS订阅,由于源站做了防跨域,所以需要用CORS-PORXY。之前一直用https://cors-anywhere.herokuapp.com,速度虽然慢吧但有现成白嫖总是好的。可是最近发现服务挂了,想了想还是去clone一下自己搭个环境吧,也不麻烦。

什么是CORS Anywhere

CORS Anywhere is a NodeJS proxy which adds CORS headers to the proxied request.

The url to proxy is literally taken from the path, validated and proxied. The protocol
part of the proxied URI is optional, and defaults to "http". If port 443 is specified,
the protocol defaults to "https".

This package does not put any restrictions on the http methods or headers, except for
cookies. Requesting user credentials is disallowed.
The app can be configured to require a header for proxying a request, for example to avoid
a direct visit from the browser.

环境要求

 node.js

安装方法

  • 去作者git把代码克隆到本地或者你的服务器上
  • cd到项目根目录
  • 编辑 server.js配置文件,修改 process.env.PORT端口,不改就默认8080QQ20200731161330.png
  • 执行 npm install
  • node server.js开启服务
最后修改:2020 年 07 月 31 日 05 : 05 PM
如果觉得我的文章对你有用,请随意赞赏