diff --git a/internal/nginx/templates/nginx-plus.ingress.tmpl b/internal/nginx/templates/nginx-plus.ingress.tmpl index b769df7e76..04b430b174 100644 --- a/internal/nginx/templates/nginx-plus.ingress.tmpl +++ b/internal/nginx/templates/nginx-plus.ingress.tmpl @@ -11,10 +11,10 @@ upstream {{$upstream.Name}} { {{end}} {{if $.Keepalive}}keepalive {{$.Keepalive}};{{end}} {{- if $upstream.UpstreamServers -}} - {{- if $upstream.Queue }} + {{- if $upstream.Queue}} queue {{$upstream.Queue}} timeout={{$upstream.QueueTimeout}}s; {{- end -}} - {{- end }} + {{- end}} } {{- end}} @@ -70,7 +70,7 @@ server { } {{- end}} - {{ with $jwt := $server.JWTAuth }} + {{with $jwt := $server.JWTAuth}} auth_jwt_key_file {{$jwt.Key}}; auth_jwt "{{.Realm}}"{{if $jwt.Token}} token={{$jwt.Token}}{{end}}; @@ -86,7 +86,7 @@ server { {{- range $healthCheck := $server.HealthChecks}} location @hc-{{$healthCheck.UpstreamName}} { - {{- range $name, $header := $healthCheck.Headers }} + {{- range $name, $header := $healthCheck.Headers}} proxy_set_header {{$name}} "{{$header}}"; {{- end }} proxy_connect_timeout {{$healthCheck.TimeoutSeconds}}s; @@ -111,7 +111,7 @@ server { # location for minion {{$location.MinionIngress.Namespace}}/{{$location.MinionIngress.Name}} {{end}} {{if $location.GRPC}} - {{if not $server.GRPCOnly}} + {{if not $server.GRPCOnly}} error_page 400 @grpcerror400; error_page 401 @grpcerror401; error_page 403 @grpcerror403; @@ -132,7 +132,7 @@ server { {{$value}}{{end}} {{- end}} - {{ with $jwt := $location.JWTAuth }} + {{with $jwt := $location.JWTAuth}} auth_jwt_key_file {{$jwt.Key}}; auth_jwt "{{.Realm}}"{{if $jwt.Token}} token={{$jwt.Token}}{{end}}; {{end}} diff --git a/internal/nginx/templates/nginx-plus.tmpl b/internal/nginx/templates/nginx-plus.tmpl index 5ffbc361ee..903a8a6719 100644 --- a/internal/nginx/templates/nginx-plus.tmpl +++ b/internal/nginx/templates/nginx-plus.tmpl @@ -22,7 +22,6 @@ events { worker_connections {{.WorkerConnections}}; } - http { include /etc/nginx/mime.types; default_type application/octet-stream; @@ -38,7 +37,7 @@ http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; - {{- end }} + {{- end}} access_log /var/log/nginx/access.log main; sendfile on; @@ -61,7 +60,6 @@ http { {{if .SSLPreferServerCiphers}}ssl_prefer_server_ciphers on;{{end}} {{if .SSLDHParam}}ssl_dhparam {{.SSLDHParam}};{{end}} - server { listen 80 default_server{{if .ProxyProtocol}} proxy_protocol{{end}}; listen 443 ssl default_server{{if .HTTP2}} http2{{end}}{{if .ProxyProtocol}} proxy_protocol{{end}}; @@ -85,7 +83,7 @@ http { } } - {{- if .NginxStatus }} + {{- if .NginxStatus}} # NGINX Plus APIs server { listen {{.NginxStatusPort}}; @@ -96,15 +94,15 @@ http { location = /dashboard.html { } - {{ range $value := .NginxStatusAllowCIDRs }}{{ if ne $value "" }} - allow {{$value}};{{ end }} - {{end}} + {{range $value := .NginxStatusAllowCIDRs}} + allow {{$value}};{{end}} + deny all; location /api { api write=off; } } - {{- end }} + {{- end}} # NGINX Plus API over unix socket server { @@ -135,11 +133,10 @@ stream { log_format stream-main '$remote_addr [$time_local] ' '$protocol $status $bytes_sent $bytes_received ' '$session_time'; - {{- end }} + {{- end}} access_log /var/log/nginx/stream-access.log stream-main; {{range $value := .StreamSnippets}} - {{$value}} - {{end}} + {{$value}}{{end}} } diff --git a/internal/nginx/templates/nginx.tmpl b/internal/nginx/templates/nginx.tmpl index b0d790db57..007cd3815f 100644 --- a/internal/nginx/templates/nginx.tmpl +++ b/internal/nginx/templates/nginx.tmpl @@ -21,7 +21,6 @@ events { worker_connections {{.WorkerConnections}}; } - http { include /etc/nginx/mime.types; default_type application/octet-stream; @@ -37,7 +36,7 @@ http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; - {{- end }} + {{- end}} access_log /var/log/nginx/access.log main; sendfile on; @@ -82,19 +81,18 @@ http { } } - {{- if .NginxStatus }} + {{- if .NginxStatus}} # stub_status server { listen {{.NginxStatusPort}}; - {{ range $value := .NginxStatusAllowCIDRs }}{{ if ne $value "" }} - allow {{$value}};{{ end }} - {{end}} + {{range $value := .NginxStatusAllowCIDRs}} + allow {{$value}};{{end}} deny all; location /stub_status { stub_status; } } - {{- end }} + {{- end}} include /etc/nginx/config-version.conf; include /etc/nginx/conf.d/*.conf; @@ -107,11 +105,10 @@ stream { log_format stream-main '$remote_addr [$time_local] ' '$protocol $status $bytes_sent $bytes_received ' '$session_time'; - {{- end }} + {{- end}} access_log /var/log/nginx/stream-access.log stream-main; {{range $value := .StreamSnippets}} - {{$value}} - {{end}} + {{$value}}{{end}} }