Skip to content

Commit 2bdc8f2

Browse files
author
Ethan Jon
committed
using default next cache-control for /static/
1 parent dfc7dbc commit 2bdc8f2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

react/server.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,9 @@ module.exports = app.prepare().then(() => {
9292
await next()
9393
})
9494

95-
// set default cache-control
96-
// but not for /_next/ paths, because HMR
95+
// set default cache-control for most paths
9796
server.use(async (ctx, next) => {
98-
if (!/\/_next\//.test(ctx.path)) {
97+
if (!/(?:\/_next\/)|(?:\/static\/)/.test(ctx.path)) {
9998
ctx.set('Cache-Control', 'public, max-age=5, s-maxage=31536000')
10099
}
101100
await next()

0 commit comments

Comments
 (0)