mindgamesnl socketio proxy
upstream socketio {
ip_hash;
server localhost:8080;
}
server {
# ...
location /socket.io/ {
if ($request_method = OPTIONS) {
add_header Content-Length 0;
add_header Content-Type text/plain;
add_header Access-Control-Allow-Origin "$http_origin" always;
add_header Access-Control-Allow-Credentials 'true' always;
add_header Access-Control-Allow-Methods "POST,GET,OPTIONS";
add_header Access-Control-Allow-Headers "content-type";
return 204;
}
proxy_pass http://socketio;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
add_header Access-Control-Allow-Origin "$http_origin" always;
add_header Access-Control-Allow-Credentials 'true' always;
}
}