mirror of
https://dev.azure.com/tstanciu94/ReverseProxy/_git/ReverseProxy_Frontend
synced 2025-10-03 16:49:04 +03:00
Refactor SPA fallback handling in nginx configuration for improved routing
This commit is contained in:
parent
52f511e271
commit
0bfbe6e9f2
12
nginx.conf
12
nginx.conf
@ -51,15 +51,11 @@ http {
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# SPA fallback - catch all routes and serve appropriate index.html
|
||||
# SPA fallback - handle client-side routing for React apps
|
||||
location / {
|
||||
try_files $uri $uri/ @fallback;
|
||||
}
|
||||
|
||||
# Fallback handler for SPA routes
|
||||
location @fallback {
|
||||
# Try to find index.html in the same directory structure
|
||||
try_files $uri/index.html /index.html;
|
||||
# First try to serve request as file, then as directory
|
||||
# If both fail, serve index.html for SPA routing
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Health check endpoint
|
||||
|
Loading…
x
Reference in New Issue
Block a user