我看到socket.js:229 WebSocket connection to 'ws://sitename.io/socket/websocket?token=&vsn=2.0.0' failed:
,想知道是不是因为nginx。
下面是我nginx配置:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name sitename.io;
location /socket/websocket/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://localhost:4000/socket/websocket;
}
location / {
proxy_pass http://localhost:4000/;
}
}
1条答案
按热度按时间yhived7q1#
这里的配置工作!原来我错过了一些重要的位。
https://hexdocs.pm/phoenix/1.3.0-rc.1/phoenix_behind_proxy.html