My socket does not connect when I use Nginx. My configuration file:
server { listen 80; return 301 https://$host$request_uri; } server { listen 443; server_name mysite.com ssl on; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; ssl_protocols TLSv1.2 TLSv1.1 TLSv1; ssl_prefer_server_ciphers on; ssl_ciphers 'kEECDH+ECDSA+AES128 kEECDH+ECDSA+AES256 kEECDH+AES128 kEECDH+AES256 kEDH+AES128 kEDH+AES256 DES-CBC3-SHA +SHA !aNULL !eNULL !LOW !MD5 !EXP !DSS !PSK !SRP !kECDH !CAMELLIA !RC4 !SEED'; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; keepalive_timeout 70; access_log /var/log/nginx/dash.log;
My NodeJS:
// Setup servers var app = express(); var HTTPSOptions = { cert: fs.readFileSync(config.ssl.server_cert), key: fs.readFileSync(config.ssl.server_key), requestCert: false, rejectUnauthorized: false, passphrase: config.ssl.server_password }; HTTPSOptions.agent = new https.Agent(HTTPSOptions); io = io.listen(server, { log: false }); io.sockets.on('connection', function (sock) { console.log("CONNECTED"); }); var httpsServer = https.createServer(HTTPSOptions, app);
And my client
var socket = io.connect('https://localhost', {secure: true}); socket.on('connect', function () { console.log("CONNECTED HERE TOO"); });
Needless to say, neither of the two console.log
shows anything. I'm worried that nginx is blocking the request and node never actually gets it?
source share