Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular on S3, refresh causes "AccessDenied" response

I have an angular 5 app - that I've been running locally, had it running with a nodjs server on heroku fine, but when I put it in an S3 bucket, behind cloudfront and i hit refresh I get this.

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>217...1C</RequestId>
<HostId>
yu2de...dr0=
</HostId>
</Error>

Any suggestions?

like image 284
j-p Avatar asked Sep 20 '25 15:09

j-p


1 Answers

You need to configure Cloudfront to handle the routing, so that all routes get redirected to index.html

Take a look at this for more info

like image 134
user184994 Avatar answered Sep 22 '25 09:09

user184994



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!