nginx之websocket

发布时间:07/01/2019 14:38 更新时间:08/02/2019 14:42

使用反向代理时,需要显式传递必要的header到代理的服务器,nginx配置示例:

location /ws {
    proxy_pass http://127.0.0.1:8080;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";

websocket聊天室:https://hehehh.com/chat

Loading...