cors-origin
v0.4.5
Published
CORS Anywhere is a reverse proxy which adds CORS headers to the proxied request. Request URL is taken from the path
Downloads
8
Maintainers
Readme
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);
});