Flask socket.io not working on live website which uses gunicorn and nginx. Code works perfectly with gunicorn on host machine
Nginx Config below:
server {
listen 80;
listen 443 ssl;
server_name domain_name;
ssl_certificate /home/azureuser/code/proj/cert.pem;
ssl_certificate_key /home/azureuser/code/proj/key.pem;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/azureuser/code/proj;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
location /socket.io {
include proxy_params;
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://127.0.0.1:443/socket.io;
}
}
Browser throws 400 error for /socket.io requests. Any Suggestions?