Amplify-console: Problems with routes and 404 page on Gatsby site in AWS Amplify

Created on 23 Jul 2020  路  6Comments  路  Source: aws-amplify/amplify-console

I have created a multi-page site with gatsby.js deployed on Amplify.

When I go to any page other than index.html, it shows me my 404.html and then after a few seconds, it shows the actual page I should see for that route.

Obviously there is something wrong with that. I deployed the same site with Netlify and that doesn't happen there.

Here are my Rewrites and redirects:

image

duplicate

Most helpful comment

</index\.html/> -> /404.html

All 6 comments

</index\.html/> -> /404.html

@ohlr that worked by it doesn't keep query params.

I have the same problem.

https://www.apresentar.me/fabricio => does not work
https://www.apresentar.me/fabricio/ => works.

Did you find a solution?

@fpsoriano I haven鈥檛 yet found a solution. I have been using Netlify instead because everything works perfectly with them.

I wish deploying to amplify didn鈥檛 include having to figure out weird bugs that simply aren鈥檛 supposed to be part of the platform :(

As noted by @ohlr the solution in #70 is currently the accepted solution for 404 rewrite behavior. As far as query string params, the target address currently only supports path based params used by most router frameworks, not the transposition of a query string, IE, the below is valid:

Source is: /docs?id=\ Target is: /documents/\

But the following is not currently directly supported ( see #97 )

Source is: /docs?id=\ Target is: /documents?id=\

That said, as others have mentioned in #97 , you can use a _trailing slash with a wildcard_ (the trailing slash is required) in the source to redirect everything (including anything you want preserved in the query string) from one path to another:

Source is: /docs/\<*>
Target is: https://myurl.com/<*>

Closing this as a duplicate of #70 and #97, please follow those issues for updates and let us know if you have any further questions in either of those issues, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

OzzieOrca picture OzzieOrca  路  3Comments

gherrera-gesintel picture gherrera-gesintel  路  4Comments

adamaltman picture adamaltman  路  3Comments

kontrol-debug picture kontrol-debug  路  4Comments

AustinZhu picture AustinZhu  路  4Comments