🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

cors-origin

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

cors-origin

CORS Anywhere is a reverse proxy which adds CORS headers to the proxied request. Request URL is taken from the path

0.4.5
latest
npm
Version published
Weekly downloads
6
200%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status Coverage Status

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

Example

// 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;
// create proxy server
var cors_proxy = require("cors-origin");
cors_proxy
  .createServer({
    originWhitelist: [], // Allow all origins
    requireHeader: ["origin", "x-requested-with"],
    removeHeaders: ["cookie", "cookie2"],
  })
  .listen(port, host, function () {
    console.log("Running CORS ORIGIN on " + host + ":" + port);
  });

Keywords

cors

FAQs

Package last updated on 17 Mar 2021

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