File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -16,23 +16,27 @@ http {
16
16
# Disable automatic trailing slash redirects
17
17
server_name_in_redirect off ;
18
18
port_in_redirect off ;
19
+
20
+ # Disable directory listing and trailing slash redirects
21
+ autoindex off ;
22
+ rewrite ^/(.*)/$ /$1 permanent;
19
23
20
24
root /usr/share/nginx/html;
21
25
index index.html;
22
26
23
27
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;
26
30
27
31
# Additional headers for SPA
28
32
add_header Cache-Control "no-cache, no-store, must-revalidate" ;
29
33
add_header Pragma "no-cache" ;
30
34
add_header Expires "0" ;
31
35
}
32
36
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;
36
40
}
37
41
38
42
# Optional: Static file caching
You can’t perform that action at this time.
0 commit comments