Skip to content

Commit 8302eca

Browse files
committed
fix: ttl parsing
1 parent 35eb96f commit 8302eca

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/templates/getHandler.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const makeHandler =
123123
let maxAge
124124
for (const part of parts) {
125125
const [key, value] = part.split('=')
126-
if (key?.trim() === 's-max-age') {
126+
if (key?.trim() === 's-maxage') {
127127
maxAge = value?.trim()
128128
}
129129
}
@@ -166,6 +166,8 @@ const makeHandler =
166166

167167
// Sending SWR headers causes undefined behaviour with the Netlify CDN
168168
const cacheHeader = multiValueHeaders['cache-control']?.[0]
169+
multiValueHeaders['x-next-cache-header'] = [cacheHeader || '']
170+
169171
if (cacheHeader?.includes('stale-while-revalidate')) {
170172
if (mode === 'odb' && process.env.EXPERIMENTAL_ODB_TTL) {
171173
mode = 'isr'
@@ -174,7 +176,7 @@ const makeHandler =
174176

175177
// Long-expiry TTL is basically no TTL
176178
if (ttl > 0 && ttl < ONE_YEAR_IN_SECONDS) {
177-
result.ttl = Math.min(ttl, 60)
179+
result.ttl = ttl
178180
multiValueHeaders['x-ttl-result'] = [result.ttl]
179181
}
180182
}

0 commit comments

Comments
 (0)