Merge pull request #46 from md5/connection-upgrade
Send "Connection: upgrade" when "Upgrade" header is received
This commit is contained in:
commit
55878cd36c
1 changed files with 11 additions and 1 deletions
12
nginx.tmpl
12
nginx.tmpl
|
@ -1,8 +1,17 @@
|
|||
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
|
||||
# scheme used to connect to this server
|
||||
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
|
||||
default $http_x_forwarded_proto;
|
||||
'' $scheme;
|
||||
}
|
||||
|
||||
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
|
||||
# Connection header that may have been passed to this server
|
||||
map $http_upgrade $proxy_connection {
|
||||
default upgrade;
|
||||
'' '';
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _; # This is just an invalid value which will never trigger on a real hostname.
|
||||
|
@ -62,7 +71,8 @@ server {
|
|||
|
||||
# HTTP 1.1 support
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $proxy_connection;
|
||||
}
|
||||
}
|
||||
{{ end }}
|
||||
|
|
Reference in a new issue