Search code examples
amazon-web-servicesgatsbyaws-amplify

AWS Amplify Redirects Gatsby 404 to Root URL


I have deployed a multi-page gatsby site both to AWS Amplify and Netlify.

When I go to a page that doesn't exist on my site that was deployed with Netlify, I get the 404 page I have created. But when I go to the same non-existent route on the site with Amplify, it redirects me to the root path.

I have checked the network tab, and I get a 404 status code without any HTTP redirects. So I assume the redirect happens in the JavaScript code?

Does this happen to anyone else?

Here is the default Rewrites and Redirects for my site on Amplify:

enter image description here


Solution

  • The solution was to change the target address from /index.html to /404.html like this:

    enter image description here