skip to Main Content

I have a static angular website which I have published to an S3 bucket. I enabled the Static website hosting on the S3 bucket, and also selected all files in the bucket and did the "Make public using ACL" option. This should make the website open to the public to view.

When I go to the bucket website endpoint given to me under the Static Website Hosting section of the S3 Properties tab I can access my website just fine. All of the hyperlinks and routing work great. However, when I try to type in the url of one of the pages on the site I get the following error:

403 Forbidden
Code: AccessDenied
Message: Access Denied

Am I missing some kind of setup in AWS to allow for the urls to work properly? I did not setup or configure any other settings in AWS. Again, the entire website works as it should as long as I do not type in a url to go to other than the default page.

2

Answers


  1. Chosen as BEST ANSWER

    After researching more on Stackoverflow I found the following which helped me out. Angular S3 Static Website - 403 Forbidden Routing Error

    Routing was working properly but typing in urls or refreshing pages caused errors. All I had to do was add index.html under the Static website hosting -> Error document property. That corrected the issues for me.


  2. That’s quite strange — if I go to the root URL, it returns an HTML page (looks pretty!).

    Something changes the URL in the address bar, but I think that’s done through Javascript rather than the browser actually going to the /dashboard location.

    In fact, I found it in this line at the bottom:

    <script src="main.898d7a46b746f05909f1.js" defer></script>
    

    In that script, this line that appears to be changing the URL in the address bar:

    const Dge=[{path:"",redirectTo:"/dashboard",pathMatch:"full"}
    

    Bottom line: Your code is pointing to /dashboard, which doesn’t exist.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search