I have a problem that might or might not be related to nginx proxy pass.
socket.io on port 7022 but nginx manages all requests on port 80. Works so very very good with socket.io and at least half-good with xhr. I never get flashsocket or html file to work. maybe not jasonp either.
I say it may be related to proxying in nginx because I did remove flashsocket months before the socket.io proxy alternative became available in nginx.
I often read on forums that socket.io simply works. "I never change anything on the server" "you should not need too...socket.io does it all for you... just leave it as it is..
My transport is down to
io.set('transports', ['websocket','xhr-polling','jsonp-polling']);
while the below is the recommended:
io.set('transports', [
'websocket'
,'flashsocket'
,'htmlfile'
,'xhr-polling'
,'jsonp-polling'
]);
this is my nginx proxy configuration
location /socket.io {
proxy_pass http://localhost:7022;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
my nginx server is also serving some static html as well as php with FastCGI server listening on 127.0.0.1:9000
Additional nginx settings
server {
listen 80;
#server blah blah
client_max_body_size 100M;
client_body_buffer_size 5M;
location / {
try_files $uri $uri/ @rewrites;
# This block will catch static file requests, such as images, css, js
location ~* \.(?:ico|css|gif|jpe?g|png)$ {
# Some basic cache-control for static files to be sent to the browser
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_buffer_size 2M;
fastcgi_intercept_errors off;
fastcgi_buffers 4 2M;
fastcgi_read_timeout 200;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
# this prevents hidden files (beginning with a period) from being served
location ~ /\. {
deny all;
}
# opt-in to the future
add_header "X-UA-Compatible" "IE=Edge,chrome=1";
Anything obvious?? Anybody else with trasport issues with socket.io? maybe in combination with nginx routing?