Making changes for cloudflare

This commit is contained in:
Kasper Rynning-Tønnesen
2015-09-09 12:47:49 +02:00
parent 16fca358e8
commit 9c0f5b4cf4

View File

@@ -1,6 +1,6 @@
var server;
try{
/*try{
var fs = require('fs');
var privateKey = fs.readFileSync('/etc/apache2/ssl/private.key', 'utf8');
var certificate = fs.readFileSync('/etc/apache2/ssl/ssl.crt', 'utf8');
@@ -17,14 +17,22 @@ try{
}).listen(8080, function() {
console.log('Running CORS Anywhere on :' + 8080);
});
}
catch(err){
}*/
//catch(err){
console.log("Starting without https (probably on localhost)");
if(err["errno"] != 34)console.log(err);
//if(err["errno"] != 34)console.log(err);
var cors_proxy = require('cors-anywhere');
cors_proxy.createServer({
requireHeader: ['origin', 'x-requested-with'],
removeHeaders: ['cookie', 'cookie2'],
httpsOptions: credentials
}).listen(8080, function() {
console.log('Running CORS Anywhere on :' + 8080);
});
var http = require('http');
server = http.createServer(handler);
}
//}
var io = require('socket.io')(server, {'pingTimeout': 25000});