The JavaScript bundle is loaded, and the front-end route is read by your static routing library. This tells S3 to serve the index.html file every time that there is a 404 error. When I was looking for a resolution to this, I noticed quite a few people suggesting to just change the Error Document field on your S3 Bucket’s Static Web Hosting settings to index.html. Because the route does not exist, the JavaScript bundle is not loaded, and the front-end static routing is never resolved. This is because there is no directory titled ‘about’ located within your S3 bucket to serve from. Unfortunately, if you refresh the page or copy/paste a url that includes a route, such as /about, you will get a 404 error. If you split your application into multiple front-end routes, using libraries such as react-router or your application will appear to work perfectly at first. This works perfectly well for single page applications, but you may run into several small issues when routing on the front-end. This allows for some pretty awesome performance as well as some great cost savings. One of the advantages of building a static-front end application in React is the ability to cache and serve it using AWS S3 and CloudFront. Hosting React App on S3 + CloudFront with React-Router (404 Fix) React Application, by Antonio Batinić at Pexels
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |