Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

256
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!