Migration Pages to Workers

Hi everyone, I need some help with a routing issue after migrating from Cloudflare Pages to Workers. I'm currently migrating my React application from Cloudflare Pages to Cloudflare Workers, and I'm facing a problem with routing. When I access the root URL (e.g., /) everything works perfectly, and I can navigate through the app without any issues — all internal routes are found correctly. However, if I try to directly open a nested route (e.g., /dashboard or /about) by entering the URL in the browser or refreshing the page, I get a 404 error. It seems like the Worker is only set up to handle the root route, and doesn't know how to serve the app properly on any other route. How can I configure my Worker to serve my React app correctly on all routes, not just the main one?
No description
No description
7 Replies
seflanka
seflankaOP3w ago
error flow:
seflanka
seflankaOP3w ago
1º start page route /
No description
seflanka
seflankaOP3w ago
2º navigate to /auth/login on click Login
seflanka
seflankaOP3w ago
No description
seflanka
seflankaOP3w ago
3º Press f5
seflanka
seflankaOP3w ago
No description
seflanka
seflankaOP3w ago
When I press f5 it gives the error 404

Did you find this page helpful?