Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Hosting react site on node.js and redirect all pages to index.html #4997
Hi, I'm trying to build a single page progressive web app with full clientside routing. This seemed to work out of the box.
I am hosting my react.js app with node.js on google app engine, and configured it like instructed at:
The static files such as js and css are perfectly reachable:
As you can see everything loads fine. But if you go into a sub path like:
It will still load the index page (good right?) but whenever it tries to load the js and css files, it will just return the index.html instead of css/js.
How do you guys usually prevent this from happening so that it loads the correct js/css on sub paths?
It would be easiest if the create-react-app would give an option for my index.html to just load the css/js/favicon/manifest.json directly from the root of my site regardless on which path it would be (eg: nodejs-static.appspot.com/first or nodejs-static.appspot.com/first/second or nodejs-static.appspot.com/first/second/third)
I have multiple domain names for the site I want to build (for multiple languages) so I wouldn't want to hardcode it.