fix(nginx): add handling for /flintstones prefix to improve URL resolution and maintain SPA functionality
This commit is contained in:
+13
-11
@@ -6,16 +6,21 @@ server {
|
|||||||
root /app/dist;
|
root /app/dist;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
# Tolerante al comportamiento de Apache (con o sin strip del prefijo):
|
# Apache en Sinbad2 reescribe la URL pública `/orcid2words/...` a un prefijo
|
||||||
# - Si llega `/orcid2words/...` → strip y servir desde dist/.
|
# interno distinto (`/flintstones/...`) antes de llegar a este contenedor.
|
||||||
# - Si llega `/` o cualquier otra ruta → servir SPA igualmente.
|
# Hay que quitar ese prefijo y servir desde dist/ igual que con `/orcid2words/`
|
||||||
# `^~` fuerza prioridad sobre cualquier regex y evita sorpresas de matching.
|
# (acceso directo al puerto 8073 sin pasar por Apache).
|
||||||
# Combinado con el `basename` dinámico de `main.jsx`, React Router se adapta.
|
|
||||||
|
location ^~ /flintstones/ {
|
||||||
|
rewrite ^/flintstones/(.*)$ /$1 break;
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /flintstones {
|
||||||
|
return 301 /flintstones/;
|
||||||
|
}
|
||||||
|
|
||||||
location ^~ /orcid2words/ {
|
location ^~ /orcid2words/ {
|
||||||
add_header X-Original-URI $request_uri always;
|
|
||||||
add_header X-Resolved-URI $uri always;
|
|
||||||
add_header X-Location-Hit "prefix-orcid2words" always;
|
|
||||||
rewrite ^/orcid2words/(.*)$ /$1 break;
|
rewrite ^/orcid2words/(.*)$ /$1 break;
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
@@ -25,9 +30,6 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
add_header X-Original-URI $request_uri always;
|
|
||||||
add_header X-Resolved-URI $uri always;
|
|
||||||
add_header X-Location-Hit "root" always;
|
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user