我已经使用ngnix成功代理了一些从本地主机到ssl端口的呼叫。
我需要代理一个websocket,并将以下内容添加到.conf
文件中:
location /ws/ {
proxy_pass http://localhost:2201/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Frame-Options SAMEORIGIN;
}
不幸的是,我一直在控制台中收到此错误:
websocket.js:118 WebSocket连接到 'wss://foo-bar-foo/socket.io/?EIO = 3&transport = websocket'失败:错误 WebSocket握手期间:意外的响应代码:404
对此我将不胜感激。