-
Notifications
You must be signed in to change notification settings - Fork 87
feat: add experimental support for TTL #833
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
Conversation
c1d4562
to
a36e76e
Compare
a36e76e
to
8576607
Compare
13ebc04
to
26df099
Compare
26df099
to
8302eca
Compare
1a30536
to
8e441e3
Compare
8e441e3
to
fd48686
Compare
Release-as: 4.0.0-beta.12
src/templates/handlerUtils.ts
Outdated
const multiValueHeaders: Record<string, Array<string>> = {} | ||
for (const key of Object.keys(headers)) { | ||
if (Array.isArray(headers[key])) { | ||
multiValueHeaders[key] = headers[key] as Array<string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could do the following instead so you don't need to coerce
const header = headers[key];
if (Array.isArray(header)) {
multiValueHeaders[key] = header
} else {
multiValueHeaders[key] = [header]
}
e92b152
to
e6bbabe
Compare
@@ -219,6 +219,57 @@ exports.moveStaticPages = async ({ netlifyConfig, target, i18n }) => { | |||
} | |||
} | |||
|
|||
const patchFile = async ({ file, from, to }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooo neat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the wait, I thought I clicked the thing. Looks awesome 😮!
Summary
Adds experimental support for ttl in pages with revalidate set. Parses the cache-control header returned by Next and extracts the
s-maxage
value, which it then uses in the ttl response. This isnlt enabled by default, but requires an env var flag.As part of the build process we need to patch the
next-server.js
file, because we need to disable caching for ISR pages and currently this is only supported forminimalMode
. We do this by adding another env var to the line where it checks for all the conditions for disabling the SSG cache.Test plan
Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal