
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Add CORS to anything!
cors-it is a Node app which acts as a proxy for arbitrary URLs, adding CORS-compliant headers:
access-control-allow-origin: *
access-control-allow-headers: Content-Type, api_key, Authorization
access-control-allow-methods: GET, POST, DELETE, PUT, PATCH, OPTIONS
to the response.
After cloning this repo, run
$ cd cors-it
$ npm install
to resolve the dependencies. (See How to install npm if you are new to Node and npm.)
Set the PORT
environment variable to an available port (for example, 9009; the default is 3000), and run cors-it with
$ PORT=9009 node index.js
To build cors-it using a docker container:
docker build -t cors-it .
docker run -p 8081:3000 cors-it
This will start cors-it at http://localhost:8081
.
Pass a URL as the url
query parameter
http://localhost:9009/?url=http://petstore.swagger.wordnik.com/api/api-docs
and cors-it will return that resource and its headers and add CORS headers.
You can test your cors-it proxy with curl(1):
curl -D - 'http://localhost:9009/?url=http://petstore.swagger.wordnik.com/api/api-docs'
HTTP/1.1 200 OK
X-Powered-By: Express
access-control-allow-origin: *
access-control-allow-headers: Content-Type, api_key, Authorization
date: Tue, 02 Dec 2014 20:01:43 GMT
access-control-allow-methods: GET, POST, DELETE, PUT, PATCH, OPTIONS
content-type: application/json; charset=utf-8
x-cache: MISS from inetgw47
transfer-encoding: chunked
via: 1.1 inetgw47 (squid)
connection: keep-alive
{"apiVersion":"1.0.0","swaggerVersion":"1.2","apis":[], ... }
If you are using swagger-editor, you can configure the editor to use your cors-it proxy in app/config/defaults.js ; just change the value of importProxyUrl to your host/port, such as
importProxyUrl: 'http://localhost:9009/?url='
Start cors-it as described above, then start swagger-editor. You should now be able to import a URL into swagger-editor from arbitrary URLs.
FAQs
Make requests CORSable!
The npm package cors-it receives a total of 0 weekly downloads. As such, cors-it popularity was classified as not popular.
We found that cors-it demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.