AWS amplify-Refreshing page with route path received AccessDenied error

AWS amplify-Refreshing page with route path received AccessDenied error

Problem:

I using Amplify + React. When I refresh the page with the route path, I received bellow error:

Actually, I think it accesses directly to S3, then does not find any corresponding files so there is no solution for this case.

After getting advice from the Technical leader by setting routing to index, I got the solution on google search by adding Rewrites and redirects rule as bellow.

Solution:

 

</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|woff2|ttf|map|json)$)([^.]+$)/>