How to Modify Your Cache Control Header in Pressable
By default, Pressable’s CDN will set the cache-control: max-age
to 7 days — unless the asset has a parameter, in which case it will be 10 years. If you’d like to increase this amount of time, you may do so by appending any parameter to your static assets.
That parameter will increase the time the asset remains cached from 7 days to 10 years.
The Pressable Cache Management plugin includes functionality to automatically do this for all jpeg
, jpg
, gif
, png
, bmp
, ico
, js
and css
files.
You can verify that the cache-control
headers have changed by running the following curl commands for the static asset(s) in question:
$ curl -sI https://149345589.v2.pressablecdn.com/wp-content/uploads/2018/08/logo-new-4x-compressed.png | grep ^cache-control cache-control: max-age=604800
$ curl -sI https://149345589.v2.pressablecdn.com/wp-content/uploads/2018/08/logo-new-4x-compressed.png?expires | grep ^cache-control cache-control: max-age=315360000