1

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.

2
  • Can you include your reactjs code? Commented May 8, 2019 at 14:23
  • Thank you Mark but as I say in the update the problem is solved by setting homepage in package.json Commented May 8, 2019 at 14:44

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.