Skip to content

Commit 6bbce05

Browse files
committed
updated routes
1 parent c343577 commit 6bbce05

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

frontend/nginx.conf

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,27 @@ http {
1616
# Disable automatic trailing slash redirects
1717
server_name_in_redirect off;
1818
port_in_redirect off;
19+
20+
# Disable directory listing and trailing slash redirects
21+
autoindex off;
22+
rewrite ^/(.*)/$ /$1 permanent;
1923

2024
root /usr/share/nginx/html;
2125
index index.html;
2226

2327
location / {
24-
# Handles Angular routing
25-
try_files $uri $uri/ /index.html;
28+
# Handles Angular routing - don't add trailing slash
29+
try_files $uri /index.html;
2630

2731
# Additional headers for SPA
2832
add_header Cache-Control "no-cache, no-store, must-revalidate";
2933
add_header Pragma "no-cache";
3034
add_header Expires "0";
3135
}
3236

33-
# Handle Angular routes without trailing slash
34-
location ~ ^/([^/]+)$ {
35-
try_files $uri $uri/ /index.html;
37+
# Handle specific routes without trailing slash redirects
38+
location ~ ^/(login|register|contact|admin|profile|home)$ {
39+
try_files $uri /index.html;
3640
}
3741

3842
# Optional: Static file caching

0 commit comments

Comments
 (0)