Serve static assets with an efficient cache policy

I have the following settings in config.toml:

[[deployment.matchers]]
# Cache static assets for 1 year.
pattern = "^.+\\.(js|css|svg|ttf|woff2)$"
cacheControl = "max-age=31536000, no-transform, public"
gzip = true

[[deployment.matchers]]
pattern = "^.+\\.(png|jpg|gif|webp)$"
cacheControl = "max-age=31536000, no-transform, public"
gzip = false

But my website is still triggering the ‘Serve static assets with an efficient cache policy’ error on Google page insights.

My website is hosted on an S3 bucket with a CloudFront distribution in front of it.

I’m not sure why the cache policy above is not finding it’s way to CloudFront - I’m using hugo deploy to push the site to AWS.

Any ideas?

Thanks,

Mario

Could you run (analyse) your website through this site and paste the link to the result.

Just an observation, you are compressing woff2 with gzip, I think the woff2 format is already compressed using brotli.

I know a little about cache control but I use .htaccess, so learning about this myself - doing it this way is the [[deployment.matchers]] a standalone setting or does it need the target?

[deployment]
[[deployment.targets]]