What is the nginx setting for the websocket server behind the nginx?

Asked 2 years ago, Updated 2 years ago, 114 views

I noticed that websocket doesn't work well just by specifying upstream from nginx on a remote server without thinking about it when I reverse-proxy.

Question

  • What settings do I need to reverse proxy websocket on nginx?

nginx websocket

2022-09-30 16:25

1 Answers

Upgrade header must be specified.

Note: WebSocket proxying

Excerpts from above page:

 location/chat/{
    proxy_pass http://backend;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}


2022-09-30 16:25

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.