From f0e300d8d10d03af7ebea7e99b3d914fa85d3482 Mon Sep 17 00:00:00 2001 From: David Bailey <4248177+davidbailey00@users.noreply.github.com> Date: Wed, 12 Dec 2018 13:21:15 +0000 Subject: [PATCH] docs(gatsby-plugin-offline): specify to not HTTP-cache sw.js (#10430) Fixes #9671 --- docs/docs/caching.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/docs/caching.md b/docs/docs/caching.md index b77592aa47765..206cff161d48a 100644 --- a/docs/docs/caching.md +++ b/docs/docs/caching.md @@ -24,6 +24,8 @@ JavaScript and CSS files _generated by webpack_ should also be cached forever. L The `cache-control` header should be `cache-control: public, max-age=31536000,immutable` +The only exception to this is the file `/sw.js`, which needs to be revalidated upon each load to check if a new version of the site is available. This file is generated by `gatsby-plugin-offline` and other service worker plugins, in order to serve content offline. Its `cache-control` header should be `cache-control: public, max-age=0, must-revalidate` + ## Setting up caching on different hosts How you setup your caching depends on how you host your site. We encourage people to create Gatsby plugins per host to automate the creation of caching headers.