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
stale-while-revalidate header used without delta-seconds #51823
Comments
Tried going backwards in time a bit. So the Wondering whether this CDN (I am unable to find it through a search engine) would accept Also CloudFront support for this feature is only a month old, so to me it is expectable that not a lot of people noticed this issue so far, if they were using AWS. |
Just confirmed that AWS CloudFront indeed ignores the CloudFront sends an Trying repeated calls on a custom NGINX page with |
We have a Next.js server/backend which responds with `s-maxage=<somevalue>, stale-while-revalidate`. See also: vercel/next.js#51823 (comment)
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
https://github.com/vercel/next.js/blob/913b365d85011473c0ec595791afa6d924a988c4/packages/next/src/server/send-payload/revalidate-headers.ts#L25C53-L25C53
To Reproduce
Render a page using
getStaticProps
in production. According to the docs and consistent with the source code this will serve aCache-Control
header in the form of:Describe the Bug
stale-while-revalidate
does not specify a delta-seconds value describing for how long the shared cache (e.g. CDN) is allowed to serve stale responses while revalidating the cache.Expected Behavior
stale-while-revalidate
must specify a delta-seconds for how long a shared cache is allowed to serve stale responses while revalidating. E.g. a valid header would be:I cross-read the informal resources at MDN and AWS CloudFront docs, none of them mentioned leaving out the delta:
Thus I also checked RFC 5861, which is specifying the header. The ABNF for the header is defined as
As you can see none of the parts is marked as optional, also the text does not refer to a default behaviour to assume if the value is left out. So I am pretty sure that according to the specification it is not allowed to leave out the time.
This might cause our CDN (CloudFront) to ignore the header entirely, resulting in poor page performance every 60 seconds (when periodically reloading the page).
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
AWS Amplify
The text was updated successfully, but these errors were encountered: