Reputation: 1629
I have uploaded my reactjs app in S3, everything is working fine, the routes work well but only on first level subpages.
For example:
myapp.com/products -> works
myapp.com/products/1 -> does not work
myapp.com/activate -> works
myapp.com/activate/user -> does not work
How can I fix this?
I've already set up the S3 bucket to redirect on index.html also in case of error, but, as I say on top, this work only for first level folder.
On localhost everything works fine.
Upvotes: 1
Views: 116
Reputation: 1629
Sorry but when I write my question I've made some test and I've noticed that react is loading also in deeper level url (app.com/first/second) but the js are not loaded correctly because the path change. The problem is solved by changing the homepage paremeters in package.json from "." to "http://myapp.com"
Hope this help someone.
Thank you
Upvotes: 1