Add connection-proxy-header annotation (#1999)

This is the override the default connection header
This commit is contained in:
Qiu Jian 2018-01-30 12:29:03 +08:00 committed by Manuel Alejandro de Brito Fontes
parent b020686599
commit 951a704cec
7 changed files with 158 additions and 5 deletions

View file

@ -119,7 +119,7 @@ http {
include /etc/nginx/mime.types;
default_type text/html;
{{ if $cfg.EnableBrotli }}
brotli on;
brotli_comp_level {{ $cfg.BrotliLevel }};
@ -242,7 +242,7 @@ http {
port_in_redirect off;
rewrite_log on;
ssl_protocols {{ $cfg.SSLProtocols }};
# turn on session caching to drastically improve performance
@ -294,7 +294,7 @@ http {
{{ range $header := $cfg.HideHeaders }}proxy_hide_header {{ $header }};
{{ end }}
{{ if not (empty $cfg.HTTPSnippet) }}
# Custom code snippet configured in the configuration configmap
{{ $cfg.HTTPSnippet }}
@ -700,10 +700,10 @@ stream {
{{/* redirect to HTTPS can be achieved forcing the redirect or having a SSL Certificate configured for the server */}}
{{ if (or $location.Rewrite.ForceSSLRedirect (and (not (empty $server.SSLCertificate)) $location.Rewrite.SSLRedirect)) }}
# enforce ssl on server side
if ($redirect_to_https) {
if ($redirect_to_https) {
{{ if $location.UsePortInRedirects }}
# using custom ports require a different rewrite directive
{{ $redirect_port := (printf ":%v" $all.ListenPorts.HTTPS) }}
{{ $redirect_port := (printf ":%v" $all.ListenPorts.HTTPS) }}
error_page 497 ={{ $all.Cfg.HTTPRedirectCode }} https://$host{{ $redirect_port }}$request_uri;
return 497;
@ -798,7 +798,11 @@ stream {
# Allow websocket connections
proxy_set_header Upgrade $http_upgrade;
{{ if $location.Connection.Enabled}}
proxy_set_header Connection {{ $location.Connection.Header }};
{{ else }}
proxy_set_header Connection $connection_upgrade;
{{ end }}
proxy_set_header X-Real-IP $the_real_ip;
{{ if $all.Cfg.ComputeFullForwardedFor }}