我正在尝试在 Digital Ocean 上托管的生产服务器上将phoenix 用于 websockets并且我不断收到
WebSocket connection to 'ws://104.236.16.92/ws' failed:
Error in connection establishment: net::ERR_NOT_IMPLEMENTED
我似乎找不到有关此问题的任何内容或可以解决此问题的方法。websockets 在我的本地机器上运行良好。
我正在尝试在 Digital Ocean 上托管的生产服务器上将phoenix 用于 websockets并且我不断收到
WebSocket connection to 'ws://104.236.16.92/ws' failed:
Error in connection establishment: net::ERR_NOT_IMPLEMENTED
我似乎找不到有关此问题的任何内容或可以解决此问题的方法。websockets 在我的本地机器上运行良好。
如果有类似的错误,那是由于牛仔处理了 nginx 代理后面的连接。在我的 nginx proxy_params 中,我必须添加以下配置才能使 websockets 工作
proxy_http_version 1.1; # recommended with keepalive connections
# WebSocket proxying - from http://nginx.org/en/docs/http/websocket.html
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
这实际上证明是没有足够的内存。我正在使用 websocket 不起作用的最低液滴。升级到层解决了我的问题。