1. My Caddy version (caddy version
):
2.0 RC1
3. The problem I’m having:
Is it possible with Caddy 2 to assign cache control headers based on file extension?
With Caddy 1 it was possible usign the expire plugin.
expires {
match (jpg|jpeg|png|gif|ico)$ 30d
}
but it is normal functionality eg. for .htaccess
<filesMatch ".(jpg|jpeg|png|gif|ico)$">
Header set Cache-Control "max-age=31536000, public"
</filesMatch>
I am looking for sollution using the Caddyfile, as the simplicity of it is the main reason why I (and I suppose many others) are interested in caddy.
5. What I already tried:
I discovered it is possible to specify system path…
header /assets/* {
Cache-Control "public, max-age=604800, must-revalidate"
}
…hovewer lot of my images are linked to individual pages, so this option is not viable.