From d5be910da65983f20b9c3930ae8c8c2b530c3172 Mon Sep 17 00:00:00 2001 From: Alexis Date: Wed, 13 May 2026 13:39:53 +0200 Subject: [PATCH] fix(nginx): prefix ^~ /orcid2words/ + diagnostic headers --- frontend/nginx.conf | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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; } }