diff --git a/packages/gatsby/src/utils/adapter/__tests__/__snapshots__/manager.ts.snap b/packages/gatsby/src/utils/adapter/__tests__/__snapshots__/manager.ts.snap index 293ef0f4e01c5..467d6ebd73252 100644 --- a/packages/gatsby/src/utils/adapter/__tests__/__snapshots__/manager.ts.snap +++ b/packages/gatsby/src/utils/adapter/__tests__/__snapshots__/manager.ts.snap @@ -359,6 +359,10 @@ exports[`getRoutesManifest should return routes manifest 2`] = ` Array [ Object { "headers": Array [ + Object { + "key": "cache-control", + "value": "public, max-age=0, must-revalidate", + }, Object { "key": "x-xss-protection", "value": "1; mode=block", @@ -387,42 +391,6 @@ Array [ ], "path": "/static/*", }, - Object { - "headers": Array [ - Object { - "key": "cache-control", - "value": "public, max-age=0, must-revalidate", - }, - ], - "path": "/", - }, - Object { - "headers": Array [ - Object { - "key": "cache-control", - "value": "public, max-age=0, must-revalidate", - }, - ], - "path": "/page-data/index/page-data.json", - }, - Object { - "headers": Array [ - Object { - "key": "cache-control", - "value": "public, max-age=0, must-revalidate", - }, - ], - "path": "/page-data/sq/d/1.json", - }, - Object { - "headers": Array [ - Object { - "key": "cache-control", - "value": "public, max-age=0, must-revalidate", - }, - ], - "path": "/page-data/app-data.json", - }, Object { "headers": Array [ Object { @@ -432,32 +400,5 @@ Array [ ], "path": "/app-123.js", }, - Object { - "headers": Array [ - Object { - "key": "cache-control", - "value": "public, max-age=0, must-revalidate", - }, - ], - "path": "/chunk-map.json", - }, - Object { - "headers": Array [ - Object { - "key": "cache-control", - "value": "public, max-age=0, must-revalidate", - }, - ], - "path": "/webpack.stats.json", - }, - Object { - "headers": Array [ - Object { - "key": "cache-control", - "value": "public, max-age=0, must-revalidate", - }, - ], - "path": "/_gatsby/slices/_gatsby-scripts-1.html", - }, ] `; diff --git a/packages/gatsby/src/utils/adapter/__tests__/manager.ts b/packages/gatsby/src/utils/adapter/__tests__/manager.ts index 348a6cb442667..d506c3b4eee98 100644 --- a/packages/gatsby/src/utils/adapter/__tests__/manager.ts +++ b/packages/gatsby/src/utils/adapter/__tests__/manager.ts @@ -156,6 +156,10 @@ describe(`getRoutesManifest`, () => { expect(headers).toContainEqual({ headers: [ + { + key: `cache-control`, + value: `public, max-age=0, must-revalidate`, + }, { key: `x-xss-protection`, value: `1; mode=block` }, { key: `x-content-type-options`, value: `nosniff` }, { key: `referrer-policy`, value: `same-origin` }, @@ -172,15 +176,6 @@ describe(`getRoutesManifest`, () => { ], path: `/static/*`, }) - expect(headers).toContainEqual({ - headers: [ - { - key: `cache-control`, - value: `public, max-age=0, must-revalidate`, - }, - ], - path: `/page-data/index/page-data.json`, - }) expect(headers).toContainEqual({ headers: [ { @@ -234,6 +229,10 @@ describe(`getRoutesManifest`, () => { expect(headers).toContainEqual({ headers: [ + { + key: `cache-control`, + value: `public, max-age=0, must-revalidate`, + }, { key: `x-xss-protection`, value: `1; mode=block` }, { key: `x-content-type-options`, value: `nosniff` }, { key: `referrer-policy`, value: `same-origin` }, @@ -250,15 +249,6 @@ describe(`getRoutesManifest`, () => { ], path: `/prefix/static/*`, }) - expect(headers).toContainEqual({ - headers: [ - { - key: `cache-control`, - value: `public, max-age=0, must-revalidate`, - }, - ], - path: `/prefix/page-data/index/page-data.json`, - }) expect(headers).toContainEqual({ headers: [ { diff --git a/packages/gatsby/src/utils/adapter/manager.ts b/packages/gatsby/src/utils/adapter/manager.ts index fbe10be215dd0..0178da120c4f9 100644 --- a/packages/gatsby/src/utils/adapter/manager.ts +++ b/packages/gatsby/src/utils/adapter/manager.ts @@ -308,7 +308,7 @@ const headersAreEqual = (a, b): boolean => const getDefaultHeaderRoutes = (pathPrefix: string): HeaderRoutes => [ { path: `${pathPrefix}/*`, - headers: BASE_HEADERS, + headers: MUST_REVALIDATE_HEADERS, }, { path: `${pathPrefix}/static/*`, @@ -319,7 +319,7 @@ const getDefaultHeaderRoutes = (pathPrefix: string): HeaderRoutes => [ const customHeaderFilter = (route: Route, pathPrefix: string) => (h: IHeader["headers"][0]): boolean => { - for (const baseHeader of BASE_HEADERS) { + for (const baseHeader of MUST_REVALIDATE_HEADERS) { if (headersAreEqual(baseHeader, h)) { return false }