-
Notifications
You must be signed in to change notification settings - Fork 124
/
server.js
35 lines (34 loc) · 1.02 KB
/
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
26
27
28
29
30
31
32
33
34
35
// code written by Rob--W author of 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 || 8080;
var cors_proxy = require("cors-anywhere");
cors_proxy
.createServer({
originBlacklist: [],
originWhitelist: [],
requireHeader: ["origin", "x-requested-with"],
removeHeaders: [
"cookie",
"cookie2",
// Strip Heroku-specific headers
"x-request-start",
"x-request-id",
"via",
"connect-time",
"total-route-time",
// Other Heroku added debug headers
// 'x-forwarded-for',
// 'x-forwarded-proto',
// 'x-forwarded-port',
],
redirectSameOrigin: true,
httpProxyOptions: {
// Do not add X-Forwarded-For, etc. headers, because Heroku already adds it.
xfwd: false,
},
})
.listen(port, host, function () {
console.log("Running CORS Anywhere on " + host + ":" + port);
});