summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/src/ssr-function.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/netlify/src/ssr-function.ts')
-rw-r--r--packages/integrations/netlify/src/ssr-function.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/integrations/netlify/src/ssr-function.ts b/packages/integrations/netlify/src/ssr-function.ts
index 7cf5ea227..42c3d1952 100644
--- a/packages/integrations/netlify/src/ssr-function.ts
+++ b/packages/integrations/netlify/src/ssr-function.ts
@@ -36,6 +36,8 @@ export const createExports = (manifest: SSRManifest, _args: Args) => {
}
if (integrationConfig.cacheOnDemandPages) {
+ const isCacheableMethod = ['GET', 'HEAD'].includes(request.method);
+
// any user-provided Cache-Control headers take precedence
const hasCacheControl = [
'Cache-Control',
@@ -43,7 +45,7 @@ export const createExports = (manifest: SSRManifest, _args: Args) => {
'Netlify-CDN-Cache-Control',
].some((header) => response.headers.has(header));
- if (!hasCacheControl) {
+ if (isCacheableMethod && !hasCacheControl) {
// caches this page for up to a year
response.headers.append('CDN-Cache-Control', 'public, max-age=31536000, must-revalidate');
}