Flask - SocketIO hidden behind reverse proxy with Nginx Flask - SocketIO hidden behind reverse proxy with Nginx flask flask

Flask - SocketIO hidden behind reverse proxy with Nginx


You need to create a special location block in nginx for the Socket.IO endpoint. You can't use a regular URL like you do for your HTTP routes.

The documentation has an example:

server {    listen 80;    server_name _;    location /socket.io {        include proxy_params;        proxy_http_version 1.1;        proxy_buffering off;        proxy_set_header Upgrade $http_upgrade;        proxy_set_header Connection "Upgrade";        proxy_pass http://127.0.0.1:5000/socket.io;    }}