404 on Dockerized react app endpoints url

Hello,

I have a 404 error (not found) when i refreshing my url on all endpoints for example https://website.com/publication/. If i refreshing on my base url https://website.com/, it’s ok.

I have a dockerized React app with vite.js, i’m building my app with vite build .
nginx for serving my app.

this is my dockerfile :
image

and my very simple nginx.conf:

server {
    listen 80;

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

koyeb is correctly setup for docker deploy (private registry):
port 80; Protocol : HTTP; Path: /

Thank you !

Hello Vincent,

I’m not sure to completely understand your problem.

From what I understand, you have a vite.js application which is rendering some static files, and you would like to serve these files with nginx. Is it correct?

What do you mean by “when I refresh my URL on all endpoints”?

Yes this is correct,
I mean when i reload my page on the web, i’ve got a 404 error but only when my url is like https://example.com/endpoint/
no 404 when i’m on base url

Is your application opensource by any chance? I could try to replicate the issue and tell your what’s wrong with it