Skip to main content

swrDelta

你可以在启用 ISR 的页面的 Cache-Control 标头中为 CDN 指定自定义的过期重新验证期间。

¥You can specify a custom stale-while-revalidate period for CDNs to consume in the Cache-Control header for ISR enabled pages.

打开 next.config.js 并添加 swrDelta 配置:

¥Open next.config.js and add the swrDelta config:

module.exports = {
// one year in seconds
swrDelta: 31536000,
}

现在,Cache-Control 标头中不再提供空的 stale-while-revalidate 句点,而是包含自定义句点。

¥Now instead of an empty stale-while-revalidate period being provided in the Cache-Control header, the custom period will be included.