Fix AWS amplify angular app error on Access Denied error

September 19, 2020

When deploy your angular app on AWS amplify, the first landing page is able to load. However, when you defined a path in your router, and try to access it, you would hit Access Denied error:

0  lLriqc  Hahb4goHm

The solution is to navigate to AWS console, select “ Rewrites and redirects”, add a new rewrite and redirects, click on “ Open text editor”, and add the below rule:

[
    {
        "source": "</^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf)$)([^.]+$)/>",
        "target": "/index.html",
        "status": "200",
        "condition": null
    }
]

0  uZ2shG4B8tpVvD6J

Try again to access your url, it should work now.

Originally published at https://victorleungtw.com on September 19, 2020.


Written by Victor Leung who is a keen traveller to see every country in the world, passionate about cutting edge technologies. Follow me on Twitter