- Newest
- Most votes
- Most comments
This isn't about query parameters, it's about finding the "root" object in a "folder".
First: S3 doesn't have folders. That we use the "/" character to separate objects names in S3 and we treat them like folders is merely a way for humans to deal with things easily.
Second: In CloudFront you will have set the default object somewhere - perhaps it is index.html
. So www.example.com
means CloudFront will get index.html
from S3. But when you request www.example.com/something/
CloudFront wants to find something/
from S3 which doesn't exist.
But there is a solution: https://aws.amazon.com/blogs/compute/implementing-default-directory-indexes-in-amazon-s3-backed-amazon-cloudfront-origins-using-lambdaedge/
Thank you for your response, the S3 bucket keys make a lot of sense.
Since I'm hosting an SPA vue.js application after two days of battling with this issue the solution seems to be to create a custom error response in CloudFront in the 'Error Pages' tab - select the '403:Forbidden' HTTP Error code and configure the Response page path to be '/index.html' with a HTTP response code to 200:OK.
Writing this comment here for anyone else struggling with this issue, hope you don't have to fight with this for 2 days like I had to.
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 4 months ago
Ok I was able to narrow down the issue to the behaviour that: www.example.com/?value=2 - query parameters will Resolve fine STATUS 200 OK www.example.com/something/?value=2 - will give Access Denied STATUS 403 FORBIDDEN www.example.com/something/ - without query parameters also gives Access Denied STATUS 403 FORBIDDEN