At the moment I'm hosting a bundled Angular-2
App in an AWS S3 bucket
, so it only contains .html
and .js
files.
The absolute path http://example.com/
does work but if I switch to any links, such as http://example.com/testsite
it returns 404 error
as below:
404 Not Found
Code: NoSuchKey
Message: The specified key does not exist.
Key: voucher
RequestId: 7A08F32C18D3C6D3
HostId: 6jTd5D5QDU+AP4vo+uRcHHVT5WeRAKjoPeqVb39xoKZZSvWWz/9TsNp41TbuKXmtpYbLZJiyqwE=
I already tried another bucket policy and I set every file to public, but it won't work for me.
Anyone has a solution? Please help.
If the requested object was available in the S3 bucket for some time and you receive a 404 NoSuchKey error again, then check the following: Confirm that the request matches the object name exactly, including the capitalization of the object name. Requests for S3 objects are case sensitive.
The "403 Access Denied" error can occur due to the following reasons: Your AWS Identity and Access Management (IAM) user or role doesn't have permissions for both s3:GetBucketPolicy and s3:PutBucketPolicy. The bucket policy denies your IAM identity permission for s3:GetBucketPolicy and s3:PutBucketPolicy.
Which S3 error code does not have a corresponding HTTP 404 Status code? You are working with the S3 API and receive an error message: 409 Conflict.
In my case, I had to specify index.html
in both Index document
and Error document
on S3 Static website hosting properties.
Your bucket policy Resource property needs to contain, note the /*:
"Resource":["arn:aws:s3:::bucketname/*"]
You also need to set the error document to be your index.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With