diff --git a/src/nginx/servers.conf.erb b/src/nginx/servers.conf.erb index 35bdd4e9..9846529d 100644 --- a/src/nginx/servers.conf.erb +++ b/src/nginx/servers.conf.erb @@ -14,23 +14,6 @@ server { error_page 404 /404.html; - location /mailbox/ { - error_page 404 /mailbox/[mailboxId].html; - } - - location /mailbox/([^/]+)/thread/ { - error_page 404 /mailbox/[mailboxId]/thread/[threadId].html; - } - - # Frontend export - location / { - try_files $uri index.html $uri/ =404; - } - - location = /404.html { - internal; - } - # Django rest framework location ^~ /api/ { proxy_set_header X-Forwarded-Proto https; @@ -51,4 +34,21 @@ server { proxy_pass http://backend_server; } + # Next static export + location ~* ^/mailbox/[^/]+$ { + try_files /mailbox/[mailboxId].html =404; + } + location ~* ^/mailbox/[^/]+/thread/[^/]+$ { + try_files /mailbox/[mailboxId]/thread/[threadId].html =404; + } + + location = /404.html { + internal; + } + + # Frontend export + location / { + try_files $uri index.html $uri/ =404; + } + } \ No newline at end of file