Nginx won't redirect to index.html
I have a react project that I am deploying to railway. When I access its root route, it works fine, but whenever I try to go to for example
/profile
and refresh page I get 404. Here is my nginx config
and here is my Dockerfile:
any ideas? Also is it worth exploring caddy for this use case maybe?14 Replies
Project ID:
8f9a18e5-76b5-4894-a3fc-54f4ddfe030b
8f9a18e5-76b5-4894-a3fc-54f4ddfe030b
Caddy is definitely worth exploring!
create react app?
Nope, this is set up using vite
you should be able to remove the Dockerfile and nginx.conf files, then copy the nixpacks.toml and Caddyfile from this repo into yours - https://github.com/brody192/vite-react-template
Tried it, but had some issues with it. Will give it another go tomorrow and let you know how it goes. Thanks!
what issues did you have with it?
And lockfile exists
please see this docs section - https://nixpacks.com/docs/providers/node#corepack
had to specify pnpm version
yep!
oh you already posted link, did not even see it 😄
this seems to be doing good so far, thanks!
automatic HTTPS is completely disabled for server
this is not relevant I assume
I get this now tho :/
nvm, port was wrong