From f95afdc35c655f8b800dc68db7e5f8271b25a9bf Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Sun, 1 Jun 2025 12:47:08 -0400 Subject: [PATCH] fix: update location blocks for protected media in nginx configuration --- backend/nginx.conf | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/backend/nginx.conf b/backend/nginx.conf index 031887a..819247e 100644 --- a/backend/nginx.conf +++ b/backend/nginx.conf @@ -30,10 +30,9 @@ http { } # Special handling for PDF files with CSP headers - location ~ ^/protectedMedia/.*\.pdf$ { + location ~ ^/protectedMedia/(.*)\.pdf$ { internal; - alias /code/media/; - try_files $uri =404; + alias /code/media/$1.pdf; add_header Content-Security-Policy "default-src 'self'; script-src 'none'; object-src 'none'; base-uri 'none'" always; add_header X-Content-Type-Options nosniff always; add_header X-Frame-Options SAMEORIGIN always; @@ -41,10 +40,9 @@ http { } # General protected media files (non-PDF) - location /protectedMedia/ { + location ~ ^/protectedMedia/(.*)$ { internal; - alias /code/media/; - try_files $uri =404; + alias /code/media/$1; } } } \ No newline at end of file