-
Notifications
You must be signed in to change notification settings - Fork 112
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
Requests cached even with Cache-Control: private #2559
Comments
Hi 👋, thanks for opening! While we look into this... If this issue is related to custom domains, be sure to check the custom domains troubleshooting guide to see if that helps. Also, there is a more general troubleshooting FAQ that may be helpful for other questions. Lastly, please make sure you've specified the |
Hi @asabourin, Your observation is correct. We have a minimum TTL defined on our distributions that forces responses to be cached for at least 2 seconds. However, we also cache based on the |
Thanks for confirming @ferdingler, so is there no way to configure the minimum TTL to be 0? This is a blocker for us because we have some speed sensitive workflows where a user triggers a refresh of some data within 2s of that data being loaded initially. The same data is fetched from the cache which results in confusion as the user doesn't see the effect of their action. |
Hi @asabourin can you confirm if you're still running into this issue? |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Before opening, please confirm:
App Id
d1ysqm6gle2xq
Region
ap-southeast-2
Amplify Console feature
Redirects
Describe the bug
We have set up a rewrite rule as per https://github.com/aws-amplify/amplify-console/blob/main/FAQ.md#reverse-proxying-to-external-api to avoid CORS preflight requests when our SPA sends requests to our API hosted on another domain.
However even though the API responses include
Cache-control: private
headers, we're still seeing requests returned from the CDN cache with thex-cache: Hit from cloudfront
header when they are fired quickly within a 1-2sec period.Looking at the bottom of the
Specifying the amount of time that CloudFront caches objects
section of https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html we suspect this is happening because there's a minimum TTL set up on the distribution, which seems confirmed by this comment.This is causing issues for our users when they perform some actions quickly in our app and are not seeing data updated accordingly.
Short of adding a "cacheBuster" param or header to all our requests, is there a way to ensure request to paths under the rewrite rule are only ever cached by the CDN if allowed by
Cache-control
?Thanks for your help!
Expected behavior
Given a rewrite rule like
we expect all requests to
/foo/*
(with or without etags header) to be cached or not by the CDN according to theCache-control
header returned byhttps://some.other.domain/resource/*
Reproduction steps
Build Settings
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: