-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cyclic redirect with CloudFront #5
Comments
Thank you for issuing. If success, the lambda redirects to I would check the full url. You mentioned, a new image is generated and accessible. If this does not help, please let me know. |
Hi @sagidM, Lambda does redirect to the correct path, as you mentioned. For example, when a user visits What is interesting, the image becomes available through S3 website endpoint, but not through CDN. As far I understood after digging deeper, the issue related to CloudFront cache. It caches redirects. So, after the first redirect to API endpoint, CF caches destination URL and status code and does same action one next visit. On this case - when Lambda returns redirect path. |
If you request |
No, browser redirects to API gateway again. The problem in CloudFront cache behavior ( Fixed by setting up CloudFlare distribution Cache Default TTL to 0 and added CacheControl to images created by Lambda:
|
Cool, thank you for sharing. |
Hello,
The Lambda function is working well, but I have cyclic redirect when trying to configure it with CloudFront.
I created a CloudFront distribution with default settings and used S3's static website endpoint as the origin. Also, I used the CloudFront domain name for the
URL
Lambda envonment variable.Existing images are served well. But for new images I receive redirects loop between API gateway and CloudFront. What is interesting, new image generated and accessible with S3's endpoint. Can't get what is wrong.
Any ideas on how to fix it?
Thank you.
The text was updated successfully, but these errors were encountered: