1. Output of caddy version
:
v2.5.2 h1:eCJdLyEyAGzuQTa5Mh3gETnYWDClo1LjtQm2q9RNZrs=
2. How I run Caddy:
caddy run -config Caddyfile.prod
a. System environment:
Mac OS 12.5.1
My complete Caddy config:
{
auto_https off
http_port 8808
}
:8808 {
root * /srv/app/public
try_files {path} /index.html
encode zstd gzip
file_server
log
respond /health 200
}
3. The problem I’m having / what I already tried
I’m trying to add different cache header depending on whether the requested path or index.html will be returned:
index.html => cache-control: no-store
else => cache-control: max-age: 31536000
I played around with
header /index.html {
Cache-Control "no-store"
}
header {
Cache-Control "max-age=31536000"
}
but I only got no-store
when there was index.html
in the request.
But I need to have no-store
whenever index.html will be returned, i.e. the requested path does not exist on the file system.
Is this possible?