Nginx listen and cache header fixes (#25092)

* only add the ipv6 listener for wildcard listen addresses

With IPv6 enabled, nginx also listened on [::] for both ports regardless of the configured listen address, so an internal port bound to 127.0.0.1 or [::1] was still reachable on every IPv6 address, and a [::]:port value rendered a duplicate listen that kept nginx from starting. The [::] listener is now added only for a bare port, *:port or 0.0.0.0:port, and a specific address binds only that address.

* mark authorized media responses private in nginx
This commit is contained in:
Josh Hawkins
2026-11-25 07:40:26 -07:00
committed by GitHub
parent fd35f4a48f
commit b213d1e73c
6 changed files with 45 additions and 9 deletions
@@ -1,12 +1,12 @@
# Internal (IPv4 always; IPv6 optional)
# Internal; a wildcard address also listens on [::] when IPv6 is enabled
listen {{ .listen.internal }};
{{ if .ipv6.enabled }}listen [::]:{{ .listen.internal_port }};{{ end }}
{{ if .listen.internal_ipv6 }}listen {{ .listen.internal_ipv6 }};{{ end }}
# intended for external traffic, protected by auth
{{ if .tls.enabled }}
# external HTTPS (IPv4 always; IPv6 optional)
# external HTTPS
listen {{ .listen.external }} ssl;
{{ if .ipv6.enabled }}listen [::]:{{ .listen.external_port }} ssl;{{ end }}
{{ if .listen.external_ipv6 }}listen {{ .listen.external_ipv6 }} ssl;{{ end }}
ssl_certificate {{ .tls.cert_path }}/fullchain.pem;
ssl_certificate_key {{ .tls.cert_path }}/privkey.pem;
@@ -30,7 +30,7 @@ listen {{ .listen.internal }};
root /etc/letsencrypt/www;
}
{{ else }}
# (No tls) default to HTTP (IPv4 always; IPv6 optional)
# (No tls) default to HTTP
listen {{ .listen.external }};
{{ if .ipv6.enabled }}listen [::]:{{ .listen.external_port }};{{ end }}
{{ if .listen.external_ipv6 }}listen {{ .listen.external_ipv6 }};{{ end }}
{{ end }}