-
Notifications
You must be signed in to change notification settings - Fork 151
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
A way to invalidate the cache of the cloudfront distribution #228
Comments
Hi, thanks for reaching out! Invalidations in CloudFront are unfortunately pretty limited since we can only invalidate by pathname. Our algorithm currently checks the pregenerated static routes and calculates the paths that should be invalidated from it. Any chance that the wrong invalidation behavior relates to this problem?
Would propose 2 solutions for the problem here: Solution 1Creating a custom CloudFront distribution and adding a custom cache behavior following the existing CloudFront example. The good thing about this is, that this works today without any changes to the module. Solution 2We could introduce a new option to invalidate the whole cache of the CloudFront distribution on every update (push). |
It is definitely related to the bug. Now it makes sense. It only invalidates the paths with dynamic slug. I saw the bug in the issues, but did not understand what was meant by it. Wasnt aware that We are using solution 2 now with the following command We would stay however with our solution for now, until the bug gets fixed. Thanks for your fast reply. |
We have now released a fix in Closing this issue for now, but but feel free to post here if this fix isn't working for you. |
Context
We deploy our NextJS app on each push. We currently face a a problem where already existing files are not updated fast enough. We currently invalidate the cache on each push to have the up to date files on our DEV environment.
Question
Is there a plan to support
ttl
values (min,default,max) for thedefault_cache_behavior
in theaws_cloudfront_distribution
terraform resource via input variables?Other Approaches
We would like to avoid creating the
default_cache_behavior
on our own, but to have a way to invalidate the cache so the up to date app is accessible. Is there a different way this can be solved?The text was updated successfully, but these errors were encountered: