All routes redirecting to root index.html on a hard refresh
See original GitHub issueWas able to get my site deployed using this plugin and everything was looking good until I realized that when you’re not using the client side routing, that all pages redirect to the root index.html page.
I am using Cloudfront to serve up assets and I’m not sure if its a configuration option with this plugin or if its a setting I have in AWS for my root document.
I’ve also invalidated my Cloudfront cache a couple of times with the instructions outlined in the docs
Should I have to set my root and error documents in Cloudfront and in the S3 static website hosting options? If so, should they both be set to index.html
or /index.html
? I have three levels of subdirectories, each with an index.
Here is the site live with the issue - https://www.drewtempleton.com – You can navigate to https://www.drewtempleton.com/photos/travel/montana within the website and it works but if you curl that endpoint with no cache or incognito, it redirects back to the root index.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (2 by maintainers)
Hi @drewbietron,
I think I know what the issue is now. I believe if you look in your CloudFront Origin configuration, you’ll find that the origin URL is www.drewtempleton.com.s3.amazonaws.com. You instead need it to say www.drewtempleton.com.s3-website-us-east-1.amazonaws.com. This is mentioned in the documentation, but maybe we can improve it to be more obvious.
Please give this a try (and remove the 403 error page in CloudFront again) and let me know if it’s fixed. After you make the change you’ll need to wait for the Distribution to update (might take 30 minutes) and you might also need to do an invalidation.
Thanks, Josh
Gonna close this now, let me know if you’re still running into any problems after implementing @JoshuaWalsh’s suggestions, @drewbietron.