1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-02-24 01:38:15 +00:00

refactor: explicitely default keepalive to disabled

This commit is contained in:
Nicolas Duchon 2023-12-26 17:58:24 +01:00
parent 35c6b2afe5
commit 26db13387e

View File

@ -249,7 +249,7 @@
{{- if exists $override }} {{- if exists $override }}
include {{ $override }}; include {{ $override }};
{{- else }} {{- else }}
{{- $keepalive := first (keys (groupByLabel .Containers "com.github.nginx-proxy.nginx-proxy.keepalive")) }} {{- $keepalive := coalesce (first (keys (groupByLabel .Containers "com.github.nginx-proxy.nginx-proxy.keepalive"))) "disabled" }}
location {{ .Path }} { location {{ .Path }} {
{{- if eq .NetworkTag "internal" }} {{- if eq .NetworkTag "internal" }}
# Only allow traffic from internal clients # Only allow traffic from internal clients
@ -263,14 +263,14 @@
root {{ trim .VhostRoot }}; root {{ trim .VhostRoot }};
include fastcgi_params; include fastcgi_params;
fastcgi_pass {{ trim .Upstream }}; fastcgi_pass {{ trim .Upstream }};
{{- if $keepalive }} {{- if ne $keepalive "disabled" }}
fastcgi_keep_conn on; fastcgi_keep_conn on;
{{- end }} {{- end }}
{{- else if eq .Proto "grpc" }} {{- else if eq .Proto "grpc" }}
grpc_pass {{ trim .Proto }}://{{ trim .Upstream }}; grpc_pass {{ trim .Proto }}://{{ trim .Upstream }};
{{- else }} {{- else }}
proxy_pass {{ trim .Proto }}://{{ trim .Upstream }}{{ trim .Dest }}; proxy_pass {{ trim .Proto }}://{{ trim .Upstream }}{{ trim .Dest }};
set $upstream_keepalive {{ if $keepalive }}true{{ else }}false{{ end }}; set $upstream_keepalive {{ if ne $keepalive "disabled" }}true{{ else }}false{{ end }};
{{- end }} {{- end }}
{{- if (exists (printf "/etc/nginx/htpasswd/%s" .Host)) }} {{- if (exists (printf "/etc/nginx/htpasswd/%s" .Host)) }}
@ -315,8 +315,8 @@ upstream {{ .Upstream }} {
# Fallback entry # Fallback entry
server 127.0.0.1 down; server 127.0.0.1 down;
{{- end }} {{- end }}
{{- $keepalive := first (keys (groupByLabel .Containers "com.github.nginx-proxy.nginx-proxy.keepalive")) }} {{- $keepalive := coalesce (first (keys (groupByLabel .Containers "com.github.nginx-proxy.nginx-proxy.keepalive"))) "disabled" }}
{{- if $keepalive }} {{- if ne $keepalive "disabled" }}
keepalive {{ $keepalive }}; keepalive {{ $keepalive }};
{{- end }} {{- end }}
} }