Skip to content
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

CloudFront Cache not being immediately invalidated after rebuild/redeploy if custom cache control header is set [Next.js - SSR] #3186

Closed
5 tasks done
nonhaltingmadness opened this issue Dec 8, 2022 · 5 comments
Labels
archived This issue has been locked. feature-request New feature or request

Comments

@nonhaltingmadness
Copy link

Before opening, please confirm:

  • I have checked to see if my question is addressed in the FAQ.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

App Id

d1gzjuqxqbagv4

AWS Region

us-west-1

Amplify Hosting feature

Custom headers, Deployments, SSR

Describe the bug

CloudFront Cache not being immediately invalidated after rebuild/redeploy if custom cache control header is set

Expected behavior

Instantaneous invalidation of CloudFront on redeployment

Reproduction steps

In next.config.js I set the Cache-Control header to "s-maxage=600".
After deployment, everything works as intended = Getting the content from cloudfront for 600sec after it fetches new data.

Observed Behavior:
Now I change the value so say "s-maxage=300".
After redeployment, I will still get all the content from the previous build, including the Cache Control header "s-maxage=600", until the specified 600seconds run out.

Build Settings

No response

Log output

# Put your logs below this line


Additional information

No response

@nonhaltingmadness nonhaltingmadness added bug Something isn't working pending-triage labels Dec 8, 2022
@ferdingler ferdingler added feature-request New feature or request and removed bug Something isn't working labels Dec 9, 2022
@github-actions
Copy link

github-actions bot commented Dec 9, 2022

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

@calavera
Copy link
Contributor

Our default behavior is to rely on the Cache-Control header because its behaviour is well known and documented.

At first glance, this can be a tricky problem to solve. For example, how would you differentiate an asset that needs to be invalidated in every deploy with another one that you always want to keep if the cache, let's say an image that never changes?

@calavera
Copy link
Contributor

This feature has just been supported with our latest launch! I'm closing this issue as it's been resolved.

Check out the details here: https://aws.amazon.com/blogs/mobile/cdn-caching-improvements-for-better-app-performance-with-aws-amplify-hosting/

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Copy link

This issue has been automatically locked.

@github-actions github-actions bot added the archived This issue has been locked. label Aug 13, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants