Description
I'm using React Router as a...
framework
Reproduction
If I build my RR7 app on Windows and move the build files to an AWS EC2 instance (Amazon Linux 2023 - CentOS), my static files do not load. All static files result in a 404 Not Found error. However, if I move the source code to the EC2 instance and build it there, everything works correctly, and the static files load properly.
STEPS TO REPRODUCDE:
- Build the project in Windows using command "npm run build"
- Move the build folder to CentOS
- Start the prod server using in CentOS using command "react-router serve /build/index.js"
- The Static file will not load and result in 404 error.
It seems the issue is due to differences in the 'location' code of server/index.js between Windows and EC2 (refer to the attached image).
System Info
Window 11,
React v19,
react-router: "7.1.1",
vite: "5.4.11",
Used Package Manager
npm
Expected Behavior
If i build my website on Windows and move the source code to Linux(CentOS) based system and start the server the static files should load correctly.
Actual Behavior
When i build my website on Windows and move the source code to Linux(CentOS) based system and start the server the static files do not load. All static files results in "404 not found" error.