Details to come...
For a detailed expolnation of Cache-Control headers.
"Public" tells Varnish that it's ok to cache, vs "private", which means only the browser can cache it. If "public" is sent without max-age or s-maxage headers, varnish will cache the request for the default ttl of 3600 seconds.
This will cached in the bowser and Varnish for 1 minute.
$response->setMaxAge(60);
Cache-Control:max-age=60, public
This will cached in the bowser for 1 minute and Varnish for 5 minutes.
$response->setMaxAge(60);
$response->setSharedMaxAge(300);
Cache-Control:max-age=60, public, s-maxage=300
This will cached in the bowser for 0 minute and Varnish for 1 minutes.
$response->setSharedMaxAge(60);
Cache-Control:public, s-maxage=60
This will cached in the bowser for 1 minute and Varnish for 0 minutes. This is because private tells Varnish not to cache it.
$response->setMaxAge(60);
$response->setPrivate();
Cache-Control:max-age=60, private
Grace mode allows you to instruct Varnish to keep an object in cache beyond its TTL and serve this stale content if your backend is not healthy or if fresh content hasn’t been fetched yet.
Content type
Image
Digest
Size
281.5 MB
Last updated
almost 10 years ago
docker pull scomm/varnish4