Skip to content

Instantly share code, notes, and snippets.

@allthingsclowd
Created March 24, 2017 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allthingsclowd/943f09ec89f73db8e238b031250bc8d0 to your computer and use it in GitHub Desktop.
Save allthingsclowd/943f09ec89f73db8e238b031250bc8d0 to your computer and use it in GitHub Desktop.
A simple NodeJS application that acts as a CORS proxy server
// Heroku defines the environment variable PORT, and requires the binding address to be 0.0.0.0
var host = process.env.PORT ? '0.0.0.0' : '127.0.0.1';
var port = process.env.PORT || 2337;
var cors_proxy = require('cors-anywhere');
cors_proxy.createServer({
originWhitelist: [], // Allow all origins
//requireHeader: ['origin', 'x-subject-token'],
}).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