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

Fix error pages' cdn cache issue. (#1794)

We do this by providing some headers mentioning not to cache.
This commit is contained in:
Arunoda Susiripala 2017-04-25 02:18:34 +05:30 committed by Guillermo Rauch
parent ff0f1e6c72
commit da775f2e11

View file

@ -123,6 +123,9 @@ export async function renderScript (req, res, page, opts) {
}
export async function renderScriptError (req, res, page, error, customFields, opts) {
// Asks CDNs and others to not to cache the errored page
res.setHeader('Cache-Control', 'no-store, must-revalidate')
if (error.code === 'ENOENT') {
res.setHeader('Content-Type', 'text/javascript')
res.end(`