As always I have searched my fingers bloody finding an answer to my issue, so I am reaching out to all you geniuses again! :)
I have set up a Node.js server with socket.io (using express) and it runs nice using port 8443. Well it runs :). Since many of my customer doesn't seem to allow traffic on port 8443 they are not able to use my services.
I am wondering how to setup Node.js on port 443 since the site using the Node-server is already using this port (Https). If I try to use port 443 on my Node-server i get: warn - error raised: Error: listen EACCES
Part of my Node-js code:
var fs = require('fs');
var https = require('https');
var express = require('express');
var socket = require('socket.io');
var port = 8443;
var sslOptions = {
pfx: fs.readFileSync('mykey.pfx'),
passphrase: ********
};
var app = express();
app.all('/*', function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With, *');
next();
});
var server = https.createServer(sslOptions, app);
var io = socket.listen(server, {
"log level" : 1,
"match origin protocol" : true,
"transports" : ['websocket', 'flashsocket'
, 'xhr-polling'
, 'jsonp-polling']
});
//No need to list all my socket events I guess
server.listen(port);
Client code to connect to my Node server:
var socket = io.connect("https://www.*MYWEBSITE*.com", { secure: true, port: 8443});
443port? If so, you can proxy all requests starting with/socket.ioto8443port. Doing so firewalls will "see" only443traffic, but some advanced webserver configuring might be required. Here is an example of proxying websocket traffic with nginx webserver - Oleg