1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Make sure that 404's is not cached by CDN:s (#5088)

This commit is contained in:
Tomas Roos 2018-09-04 14:13:15 +02:00 committed by Tim Neutkens
parent a6114d4d65
commit 9abbea8571

View file

@ -193,7 +193,7 @@ async function doRender (req, res, pathname, query, {
export async function renderScriptError (req, res, page, error) {
// Asks CDNs and others to not to cache the errored page
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate')
res.setHeader('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate')
if (error.code === 'ENOENT' || error.message === 'INVALID_BUILD_ID') {
res.statusCode = 404