2

I have an question concerning AWS s3 and cloudfront. I host the build of a private page (vue-app) on s3 and access it via cloudfront (I wrote a permission in the S3 bucket using the OAI from a cloudfront-origin.). Everything works well: When I call the root url (xxx.cloudfront.net/) I can access my webapp. When I call this url my webapp adds to the root-url: 'app/documents' and loads the content. But I assume that sometimes user try to directly access the url: 'xxx.cloudfront.net/app/documents'. Up to now this does not work: I get an AccessDenied (from S3). What should I do? My goal is that when someone enters a specific domain (not the root domain, for example: xxx.cloudfront.net/app/documents/4, he will be able to directly access the document with the id 4. Is something like this possible?

PS: I already took a look at the answer in this question but this does not work for me. If I use a custom domain, I do not get an Origin Access Identity which I use in the permission file in S3 (so that only cloudfront can access the s3 code). I have also seen this question which seems to be very similar. This recommends to append an index.html to every request. Maybe I do not have the knowledge but in my S3-bucket is only one index.html (the root one). How could this then work?

Thank you and all the best, Lukas

Lasklu
  • 103
  • 1
  • 5

1 Answers1

0

You need to make your S3 bucket public.

You can follow this link: https://aws.amazon.com/premiumsupport/knowledge-center/read-access-objects-s3-bucket/

You need to open the S3 ACL and make your object public.

Chuong Nguyen
  • 1,077
  • 6
  • 15