diff --git a/frontend/nginx.conf b/frontend/nginx.conf index 34c0978..73b67a2 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -7,16 +7,27 @@ server { index index.html; # Tolerante al comportamiento de Apache (con o sin strip del prefijo): - # - Si llega `/orcid2words[/...]` → strip y servir. + # - Si llega `/orcid2words/...` → strip y servir desde dist/. # - Si llega `/` o cualquier otra ruta → servir SPA igualmente. + # `^~` fuerza prioridad sobre cualquier regex y evita sorpresas de matching. # Combinado con el `basename` dinámico de `main.jsx`, React Router se adapta. - location ~ ^/orcid2words(/.*)?$ { - rewrite ^/orcid2words/?(.*)$ /$1 break; + 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; try_files $uri $uri/ /index.html; } + location = /orcid2words { + return 301 /orcid2words/; + } + 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; } }