Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

auto-cors

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-cors

A proxy to automatically add CORS headers

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

auto-cors

A proxy to automatically add CORS headers, supports:

  • Simple requests with Access-Control-Allow-Origin: "*"
  • preflight requests for non-simple requests.
  • POST/PUT requests with body.
  • CORS requests with credentials included.

There's an auto-cors service deployed at cors.harttle.com. Both HTTP and HTTPS are supported:

  • http://cors.harttle.com/https://example.com
  • https://cors.harttle.com/https://example.com

Set Cookie when forward, cookie is not allowed to be set for fetch

fetch("https://cors.harttle.com/https://example.com", {
    headers: {
        "AutoCORS-Cookie": "XXX"
    }
})

Will set a "Cookie: XXX" header when request is forwarded.

Deploy your server

Install node and npm, then run

npx auto-cors

Use AUTO_CORS_PORT (defaults to 8080) to set a different port, for example:

AUTO_CORS_PORT=8080 npx auto-cors

Visit http://localhost:8080/https://example.com in your browser.

Systemd

Here's a systemd script for auto-cors:

https://gist.github.com/harttle/a801084f42b9ee1a2aa6bf5c191b9ad9

FAQs

Package last updated on 14 Aug 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc