When deploying a ReactJS application to AWS S3 you have to ensure you setup a custom error page to handle React Router. ReactJS relies on all traffic routing to `index.html` where a library like React Router can pick up and direct requests to the right components. In order for this to work correctly you need to set up a custom error page in AWS.

CloudFront Configuration

Navigate to CloudFront and click on the name of your existing distribution, and click the `Error Pages` tab.

Click `Create Custom Error Response` to load the new error response form.

Providing the values displayed above will tell AWS to send users to `index.html` when they visit any unknown paths.

  • No labels