Nginx proxy Websocket parameters that need attention

Nginx proxy Websocket parameters that need attention

#Preface

The Websocket provided to the outside world is basically based on the wss protocol, which is generally reversed through Nginx+SSL certificate

#Proxy Parameter

If the proxy connection and operation time waiting time are not set, the default is 5 minutes if there is no sending and pushing messages, it will be disconnected. Sometimes the vacancy period of some businesses may exceed 5 minutes. The following time parameters can be adjusted according to the business

#Parameter example

location / {
      proxy_pass http://127.0.0.1:10006;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_read_timeout 1200s;
      proxy_connect_timeout 1200s;
      proxy_send_timeout 1200s;
}

#Support Author

coffee


Did you enjoyed the article ?
Subscribe to the newsletter 👨‍💻

Be the first to know when I write something new! If you don't like emails, you can follow me on GitHub.