Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

257
Vistas
React app with Nginx produces duplicate sub routes

We have a react App with react router, We build a Docker container and serve the App with an Nginx. Here is the nginx.conf:

server {
  listen       80;
  location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
    try_files $uri /index.html =404;
  }
}

We show a list of Items on a page and on a click one can see some more information about the item:

<Routes>
      <Route path="/" element={<Patients />} />
      <Route path="/add" element={<AddPatient />} />
      <Route path="/:patientId" element={<Patient />} />
      <Route path="/:patientId/update" element={<UpdatePatient />} />
      <Route path="/:patientId/wounds/add" element={<AddWound />} />
      <Route path="/:patientId/wounds/:woundId/update" element={<UpdateWound />} />
      <Route path="*" element={<Navigate to="/" />} />
</Routes>

However when I deploy the App something weired happens:

I expect the App to use a Route like this:

https://<publicDomain>/app/patients/605db06b642296fa97b7c4c0

But it uses this link:

https://<publicDomain>/app/patients/app/patients/605db06b642296fa97b7c4c0

So a part of the URL is duplicated which leads to the fact that the app surely is not opening any new details view.

How can I stop it, that parts of the route are duplicated?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

--update--

So I solved my problem by changing the nginx.conf from this:

server {
  listen       80;
  location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
    try_files $uri /index.html =404;
  }
}

to this:

server {
  listen       80;
  root   /usr/share/nginx/html;
  location / {
    try_files $uri /index.html;
  }
}

However, I dont really understand the big difference it makes. So if anyone can explain, I would really appreciate.

Thanks in advance

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda