fix nginx header inheritance and ws proxy path

Locations that include auth_request.conf declare their own add_header lines, so nginx dropped the server-level nosniff and Referrer-Policy headers on /recordings/, /exports/, /ws, /live/*, and several /api/ routes. auth_request.conf now includes security_headers.conf itself, and the duplicate includes in /vod/, /stream/, /clips/, and /api/ are removed. The /ws proxy_pass no longer carries a trailing slash, so nginx forwards the original path instead of rewriting /ws to /, which closes the path normalization gap gixy flagged.
This commit is contained in:
Josh Hawkins
2026-11-21 15:32:15 -06:00
parent 0604d90549
commit 05da6edc6e
2 changed files with 4 additions and 5 deletions
@@ -22,3 +22,6 @@ add_header Set-Cookie $auth_cookie;
## Pass the location header back up if it exists ## Pass the location header back up if it exists
auth_request_set $redirection_url $upstream_http_location; auth_request_set $redirection_url $upstream_http_location;
add_header Location $redirection_url; add_header Location $redirection_url;
## The add_header lines above stop this location inheriting server-level headers
include security_headers.conf;
@@ -152,7 +152,6 @@ http {
sub_filter '.m4s' '.m4s$is_args$args'; sub_filter '.m4s' '.m4s$is_args$args';
sub_filter '.mp4"' '.mp4$is_args$args"'; sub_filter '.mp4"' '.mp4$is_args$args"';
include security_headers.conf;
add_header Cache-Control "no-store"; add_header Cache-Control "no-store";
expires off; expires off;
@@ -161,7 +160,6 @@ http {
location /stream/ { location /stream/ {
include auth_request.conf; include auth_request.conf;
include security_headers.conf;
add_header Cache-Control "no-store"; add_header Cache-Control "no-store";
expires off; expires off;
@@ -185,7 +183,6 @@ http {
} }
expires 7d; expires 7d;
include security_headers.conf;
add_header Cache-Control "public"; add_header Cache-Control "public";
autoindex on; autoindex on;
root /media/frigate; root /media/frigate;
@@ -226,7 +223,7 @@ http {
location /ws { location /ws {
include auth_request.conf; include auth_request.conf;
proxy_pass http://mqtt_ws/; proxy_pass http://mqtt_ws;
include proxy.conf; include proxy.conf;
} }
@@ -290,7 +287,6 @@ http {
location /api/ { location /api/ {
include auth_request.conf; include auth_request.conf;
include security_headers.conf;
add_header Cache-Control "no-store"; add_header Cache-Control "no-store";
expires off; expires off;
proxy_pass http://frigate_api/; proxy_pass http://frigate_api/;