If you are seeing the “Serve static assets with an efficient cache policy” notice in PageSpeed, you need to add the Cache-Control header to your website.

Here is how to do it if you are using Caddy.

Cache-Control

To set a Cache-Control header only for your static files like, .js, .jpg, and others, just add this to the relevant part of your Caddyfile(under the site block if the Caddyfile includes multiple websites)

 1 2 3 4 5  @static { file path *.ico *.css *.js *.gif *.webp *.avif *.jpg *.jpeg *.png *.svg *.woff *.woff2 } header @static Cache-Control max-age=5184000 

The files are going to be cached for 5184000 seconds, so 60 days, you can change it if you want.