Cache Control Headers for Jekyll Site

Hi there,

Is there an example of a netlify.toml file for Jekyll sites that has Headers Cache Control?

I’m using the below settings but its having no effect when tested at Google pagespeed

global context

[build]
publish = “_site/”
command = “jekyll build”
environment = { JEKYLL_ENV = “netlify” }

[[headers]]
for = “/assets/images/"
[headers.values]
Cache-Control = “public, s-max-age=604800”
[[headers]]
for = "/images/

[headers.values]
Cache-Control = “public, s-max-age=604800”
[[headers]]
for = “/assets/css/.css"
[headers.values]
Cache-Control = “public, s-max-age=604800”
[[headers]]
for = "/assets/js/
.js”
[headers.values]
Cache-Control = “public, s-max-age=604800”

I think Google page speed is not the correct way to test cache control. Netlify automatically add the correct headers: Better Living Through Caching | Netlify

Thanks for your response.

Ok I will remove the netlify.toml file and let Netlify control the Headers.

1 Like