react 404
my react app works on local host and it works when deployed so if i click onto one of the pages it works but if i refresh that page it just breaks and sends a 404 also if i where to search example.com/faq i will be shown 404 as well
Solution:Jump to solution
heres an example repo https://github.com/brody192/create-react-app-starter
dont seperate the build folder out into another repo.
copy the nixpacks.toml and Caddyfile from my repo into your project repo and deploy the project repo instead...
23 Replies
Project ID:
N/A
please share your repo
classic: no redirect is set up for client side routing
theres something odd going on though, if they where using a dev server the /fag page would work
doesn't a static "thingy" on railway need it to be configured separately?
if I just build a vite+react project and put it as is it would behave the same
if you uploaded just the build folder yes
well they didn't say "a next app" so I assume a static build
ok not gonna argue
yeah but they are likely uploading the entire project folder, package.json and all. theres too many unknowns, thats why i asked for the repo
Sorry I just went out for food so I’m afk but I’m not using vite and I just pulled the build into its own repo and then deployed that
create react app?
Yep
Solution
heres an example repo https://github.com/brody192/create-react-app-starter
dont seperate the build folder out into another repo.
copy the nixpacks.toml and Caddyfile from my repo into your project repo and deploy the project repo instead
The reason I pulled the build folder was when I deployed it, the react dev tools was red meaning that it wasn’t correct and the usage was crazy
because you where running a development server
Yh how do I not do that😂😂
see my message above
This
yeah, read the readme for further info
Thank you will try when I get back
brody you the goat, 3 months ago i had my head spun because i was just uploading my full repo and it took 2 days & 3 compsi students to figuire out how to deploy a react app that didn't have stupid usage and i just spent the whole day looking at other people's tickets in the help section and this literally worked first time no problems
happy i could help
railway is not like vercel, railway runs your code as is and uses the default start script, if the start script starts a development server, then a development server is what will be ran
ah i see, can you give me a better understanding of deploying react apps im self taught no one around me not even my friends that are juniors could explain how react works when deploying like what's the industry norm of deploying a react app and is there a difference of deploying a react vite app?
neither create react app or vite come with production ready web servers, thats where caddy comes into play. as mentioned railway is not like vercel so we have to setup the web server ourselves (caddy)
but i have never built a site with react or any framework for that matter, so im no help with that side of things, i only know how to deploy them
ohhhhhh okay i see thank you very much