diff --git a/nginx.conf b/nginx.conf index f5ee25bbad..80d6c14140 100644 --- a/nginx.conf +++ b/nginx.conf @@ -52,6 +52,9 @@ http { if ($http_x_forwarded_proto = 'https') { set $real_scheme https; } + + # Force HTTPS in absolute redirects + absolute_redirect off; # Security headers add_header X-Frame-Options "SAMEORIGIN" always; @@ -65,6 +68,14 @@ http { add_header Cache-Control "public, immutable"; } + # Handle trailing slash redirects with proper scheme + location ~ ^([^.]*[^/])$ { + if (-d $document_root$1/) { + return 301 $real_scheme://$host$1/; + } + try_files $uri /index.html; + } + # Handle client-side routing for SPA location / { try_files $uri $uri/ /index.html;