Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down