Created
February 13, 2020 05:06
-
-
Save WeiChiaChang/64cbe6eea51cd3bfc0dd259a30952c6f to your computer and use it in GitHub Desktop.
cors-anywhere
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference: | |
// https://github.com/Rob--W/cors-anywhere | |
// 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 || 8081; | |
var cors_proxy = require('cors-anywhere'); | |
cors_proxy.createServer({ | |
originWhitelist: [], // Allow all origins | |
requireHeader: ['origin', 'x-requested-with'], | |
removeHeaders: ['cookie', 'cookie2'] | |
}).listen(port, host, function() { | |
console.log('Running CORS Anywhere on ' + host + ':' + port); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment