Skip to content

Commit bfc6a53

Browse files
committed
allow non-standard listen ports for Plus
1 parent 55ccbbe commit bfc6a53

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

nginx-controller/nginx/templates/nginx-plus.ingress.tmpl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ upstream {{$upstream.Name}} {
1111

1212
{{range $server := .Servers}}
1313
server {
14-
listen 80{{if $server.ProxyProtocol}} proxy_protocol{{end}};
14+
{{range $port := $server.Ports}}
15+
listen {{$port}}{{if $server.ProxyProtocol}} proxy_protocol{{end}};
16+
{{- end}}
1517
{{if $server.SSL}}
16-
listen 443 ssl{{if $server.HTTP2}} http2{{end}}{{if $server.ProxyProtocol}} proxy_protocol{{end}};
18+
{{- range $port := $server.SSLPorts}}
19+
listen {{$port}} ssl{{if $server.HTTP2}} http2{{end}}{{if $server.ProxyProtocol}} proxy_protocol{{end}};
20+
{{- end}}
1721
ssl_certificate {{$server.SSLCertificate}};
1822
ssl_certificate_key {{$server.SSLCertificateKey}};
1923
{{end}}
@@ -35,7 +39,7 @@ server {
3539

3640
{{if $server.SSL}}
3741
if ($scheme = http) {
38-
return 301 https://$host$request_uri;
42+
return 301 https://$host:{{index $server.SSLPorts 0}}$request_uri;
3943
}
4044
{{- if $server.HSTS}}
4145
add_header Strict-Transport-Security "max-age={{$server.HSTSMaxAge}}; {{if $server.HSTSIncludeSubdomains}}includeSubDomains; {{end}}preload" always;{{end}}

0 commit comments

Comments
 (0)