From 0028cdafe9e06d2d8eb70c8d4824f1331dd2b71f Mon Sep 17 00:00:00 2001 From: Mike Dillon Date: Sat, 25 Oct 2014 17:13:04 -0700 Subject: [PATCH 1/2] Add comment about X-Forwarded-Proto mapping --- nginx.tmpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nginx.tmpl b/nginx.tmpl index f0cae0d..cb558e5 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -1,3 +1,5 @@ +# 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; From 6c2221bdccccc5e0e23e74a9b5ca852b4a418968 Mon Sep 17 00:00:00 2001 From: Mike Dillon Date: Sat, 25 Oct 2014 17:13:17 -0700 Subject: [PATCH 2/2] Set "Connection: upgrade" when we receive an "Upgrade" header Fixes #37 --- nginx.tmpl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nginx.tmpl b/nginx.tmpl index cb558e5..42599f7 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -5,6 +5,13 @@ map $http_x_forwarded_proto $proxy_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. @@ -64,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 }}