2 Answers
- Newest
- Most votes
- Most comments
3
Thanks for the detailed description. You are getting 403 Forbidden
due to the origin request policy AllViewer
being used. In this case, when you access the website via CloudFront URL, the Host
header similar to d12345678.cloudfront.net
will be forwarded to the Lambda which will not be recognized, resulting in 403.
The solution is to create your custom origin request policy and only forward the necessary values (but not the Host
header.)
answered 2 years ago
-2
Please check out this blog if you haven't already - https://aws.amazon.com/blogs/networking-and-content-delivery/using-amazon-cloudfront-with-aws-lambda-as-origin-to-accelerate-your-web-applications/
Relevant content
- asked 9 days ago
- asked 2 years ago
- asked a year ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
Thank you, it works so well, for my case, I also need to also forward
origin
anduser-agent
but it is because of my lambda function code.