Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby-plugin-netlify): Do not cache static query data #26387

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ X-Frame-Options
Cache-Control: public, max-age=31536000, immutable
/static/*
Cache-Control: public, max-age=31536000, immutable
/static/d/*
Cache-Control: public, max-age=0, must-revalidate
/sw.js
Cache-Control: no-cache
/offline-plugin-app-shell-fallback/
Expand Down Expand Up @@ -118,6 +120,8 @@ exports[`build-headers-program with caching headers 1`] = `
Cache-Control: public, max-age=31536000, immutable
/static/*
Cache-Control: public, max-age=31536000, immutable
/static/d/*
Cache-Control: public, max-age=0, must-revalidate
/sw.js
Cache-Control: no-cache
/offline-plugin-app-shell-fallback/
Expand Down Expand Up @@ -208,6 +212,8 @@ exports[`build-headers-program with manifest['pages-manifest'] 1`] = `
Cache-Control: public, max-age=31536000, immutable
/static/*
Cache-Control: public, max-age=31536000, immutable
/static/d/*
Cache-Control: public, max-age=0, must-revalidate
/sw.js
Cache-Control: no-cache
/offline-plugin-app-shell-fallback/
Expand Down Expand Up @@ -285,6 +291,8 @@ exports[`build-headers-program with security headers 1`] = `
Cache-Control: public, max-age=31536000, immutable
/static/*
Cache-Control: public, max-age=31536000, immutable
/static/d/*
Cache-Control: public, max-age=0, must-revalidate
/sw.js
Cache-Control: no-cache
/offline-plugin-app-shell-fallback/
Expand Down
2 changes: 2 additions & 0 deletions packages/gatsby-plugin-netlify/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ export const SECURITY_HEADERS = {
}

export const IMMUTABLE_CACHING_HEADER = `Cache-Control: public, max-age=31536000, immutable`
const NO_CACHING_HEADER = `Cache-Control: public, max-age=0, must-revalidate`

export const CACHING_HEADERS = {
"/static/*": [IMMUTABLE_CACHING_HEADER],
"/static/d/*": [NO_CACHING_HEADER],
"/sw.js": [`Cache-Control: no-cache`],
}

Expand Down