Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - pswerlang

Pages: [1]
1
Nginx / Re: Websocket ssl on nginx
« on: August 05, 2022, 08:56:55 PM »
Hello. I've found a way to redirect the server's websocket port to port 80 (or wss to 443).
On the vhosts conf file (WebServers Conf Editor > /etc/nginx/conf.d/vhosts/ tab), you should locate the location / { ... } part.

Replace the entire location / { ... } part with this:

Code: [Select]
location / {
  proxy_set_header HOST $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_pass_request_headers on;
  proxy_pass http://YOUR_SERVER_IP:WEBSOCKET_PORT;
  proxy_http_version 1.0;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "Upgrade";
}

You should change only YOUR_SERVER_IP and WEBSOCKET_PORT part with the respective information. Leave the rest as it is. If you are editing the SSL conf file, instead of http you should use https.

It is working for me. I just wish someone directed me as how to create a template from this, to be able to use the CWP ui to set this config instead of by hand.

Pages: [1]