Merge pull request #1808 from whitlockjc/document-nginx-connection-header

Automatic merge from submit-queue

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.
This commit is contained in:
Kubernetes Submit Queue 2016-10-05 10:09:18 -07:00 committed by GitHub
commit a2aae637dc

View file

@ -93,6 +93,13 @@ http {
resolver_timeout 10s; resolver_timeout 10s;
{{ end }} {{ 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 { map $http_upgrade $connection_upgrade {
default upgrade; default upgrade;
'' close; '' close;