Skip to content

Commit

Permalink
fix(gatsby-plugin-netlify): Do not cache static query data
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmithbaylor committed Aug 12, 2020
1 parent bfe9ce5 commit 2eb123e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
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

0 comments on commit 2eb123e

Please sign in to comment.