From 0373ce6f31a09bbd9210d1ad2ad4423a2ad1fcc3 Mon Sep 17 00:00:00 2001 From: Jeremy Whitlock Date: Thu, 29 Sep 2016 15:42:46 -0600 Subject: [PATCH] ingress/controllers/nginx: WebSocket documentation For those that do not understand the default way in which nginx proxies requests not containing a "Connection" header, the approach for enabling WebSocket support might not make sense. This commit adds documentation that explains why things are done this way. --- controllers/nginx/nginx.tmpl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controllers/nginx/nginx.tmpl b/controllers/nginx/nginx.tmpl index 18548282c..784f19d30 100644 --- a/controllers/nginx/nginx.tmpl +++ b/controllers/nginx/nginx.tmpl @@ -92,6 +92,13 @@ http { resolver {{ .defResolver }} valid=30s; {{ end }} + {{/* Whenever nginx proxies a request without a "Connection" header, the "Connection" header is set to "close" */}} + {{/* when making the target request. This means that you cannot simply use */}} + {{/* "proxy_set_header Connection $http_connection" for WebSocket support because in this case, the */}} + {{/* "Connection" header would be set to "" whenever the original request did not have a "Connection" header, */}} + {{/* which would mean no "Connection" header would be in the target request. Since this would deviate from */}} + {{/* normal nginx behavior we have to use this approach. */}} + # Retain the default nginx handling of requests without a "Connection" header map $http_upgrade $connection_upgrade { default upgrade; '' close;