Skip to content

Instantly share code, notes, and snippets.

@alexblom
Last active August 8, 2019 03:13
Show Gist options
  • Save alexblom/98669900f9784eac1262 to your computer and use it in GitHub Desktop.
Save alexblom/98669900f9784eac1262 to your computer and use it in GitHub Desktop.
Golang Websocket Nginx
#Golang Websocket Server
server {
listen 8080;
server_name wss.morse.io;
access_log /var/log/nginx/access_log.log;
error_log /var/log/nginx/error.log;
#ssl config
ssl on;
#Cert Info
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
proxy_read_timeout 300s;
location /goServer {
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:8081/goServer;
}
}
@nteissler
Copy link

Just ran into this same issue. The post here solved my problems with nothing but a copy and paste. I'm looking into what all the settings mean now.

http://stackoverflow.com/questions/22091351/unable-to-get-go-net-websocket-working-behind-nginx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment