benjamincburns/websockproxy

How to set up reverse proxy with nginx for wss?

Closed this issue · 1 comments

Can someone please share their setup for getting nginx to serve this with wss using a letsencrypt certificate?

I solved this. Here's the solution for anyone else who might be interested:

http {
  server {
   listen 443 http2 ssl;
   listen [::]:443 http2 ssl;

   server_name my.proxy_domain.com;
   ssl_certificate  /root/fullchain.pem;
   ssl_certificate_key  /root/privkey.pem;
   ssl_prefer_server_ciphers on;

   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	http://localhost:80;
	proxy_read_timeout   90;

	proxy_http_version   1.1;
	proxy_set_header     Upgrade $http_upgrade;
	proxy_set_header     Connection "upgrade";	
   }
  }
}