WebSocket proxying

http://nginx.org/en/docs/http/websocket.html
This commit is contained in:
Eric Nemchik 2020-09-01 09:02:42 -05:00
parent 055801b05b
commit 9f1cc323b1
2 changed files with 11 additions and 2 deletions

View File

@ -23,7 +23,7 @@ http {
types_hash_max_size 2048;
variables_hash_max_size 2048;
large_client_header_buffers 4 16k;
# server_tokens off;
# server_names_hash_bucket_size 64;
@ -72,6 +72,14 @@ http {
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# WebSocket proxying
##
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
##
# Virtual Host Configs
##

View File

@ -23,7 +23,8 @@ proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Ssl on;
proxy_redirect http:// $scheme://;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
#proxy_cookie_path / "/; HTTPOnly; Secure"; # enable at your own risk, may break certain apps
proxy_cache_bypass $cookie_session;
proxy_no_cache $cookie_session;