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)
|
|
The files are going to be cached for 5184000
seconds, so 60 days, you can change it if you want.
Source
https://caddy.community/t/correct-way-to-set-expires-on-caddy-2/7914/13