admin管理员组文章数量:1122826
Im trying to protect a server who use socket.io to handle websocket connections. Howewer, I don't manage to get my nginx reverse proxy working with it.
Requests on web console ( no reverse used ), everything works fine :
Once the reverse is active, socket.io don't work anymore. That's what I got :
I can't connect to the websocket and I don't get any error logs. Here my nginx configuration :
upstream socketIOserver {
server protectedIP:80;
}
server {
listen 80;
listen [::]:80;
http2 on;
server_name api.domain;
error_log /var/log/nginx/error.log;
location /socket.io/ {
proxy_pass http://socketIOserver/socket.io/;
proxy_buffering off;
proxy_cache off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_buffers 8 32k;
proxy_buffer_size 64k;
proxy_connect_timeout 7d;
proxy_send_timeout 7d;
proxy_read_timeout 7d;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
location / {
proxy_pass http://socketIOserver;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr; # This line.
proxy_set_header Host $host;
}
}
Thanks for your help.
本文标签: websocketSocketio don39t work with nginx reverse proxyStack Overflow
版权声明:本文标题:websocket - Socket.io don't work with nginx reverse proxy - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736301763a1931290.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论