I'm trying to setup a websocket connection (wss). My domain uses ssl (certbot) and is powered by Nginx. I am unsure how to configure my /etc/nginx/sites-available/domain.com
file.
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
...
}
I added the following into my config block:
location /websocket {
proxy_pass https://domain.com;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
When connecting via: wss://domain.com/
, I am getting an error of
WebSocket connection to 'wss://domain.com/' failed:
Error during WebSocket handshake: Unexpected response code: 200
Most of the examples out there are using a nodejs framework to serve their sites, but I am using php.