-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
25 lines (24 loc) · 827 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// 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 || 443;
var cors_proxy = require('./lib/cors-anywhere');
cors_proxy.createServer({
requireHeader: ['origin', 'x-requested-with'],
removeHeaders: [
'cookie',
'cookie2',
// Strip Heroku-specific headers
'x-heroku-queue-wait-time',
'x-heroku-queue-depth',
'x-heroku-dynos-in-use',
'x-request-start'
],
httpProxyOptions: {
enable: {
// Do not add X-Forwarded-For, etc. headers, because Heroku already adds it.
xforward: false
}
}
}).listen(port, host, function() {
console.log('Running CORS Anywhere on ' + host + ':' + port);
});