cors-origin

0.4.5 • Public • Published

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);
  });

/cors-origin/

    Package Sidebar

    Install

    npm i cors-origin

    Weekly Downloads

    1

    Version

    0.4.5

    License

    MIT

    Unpacked Size

    103 kB

    Total Files

    20

    Last publish

    Collaborators

    • mahesh_talaviya