1. Caddy version (caddy version
):
v2.4.4 h1:QBsN1jXEsCqRpKPBb8ebVnBNgPxwL50HINWWTuZ7evU=
2. How I run Caddy:
service caddy start
a. System environment:
ubuntu 20.04.1
b. Command:
service caddy start
d. My complete Caddyfile or JSON config:
staging01.ktbyte.com {
file_server {
root /home/ubuntu/earth-landing
}
handle_errors {
reverse_proxy http://localhost:4567 {
lb_try_duration 60s
fail_duration 1s
health_uri /health
health_interval 1s
}
route {
header /resources/* Cache-Control max-age=86400
}
}
}
3. The problem I’m having:
I am trying to replace my cache-control header for a specific path. But here’s what I see - two cache-control headers:
curl -sSL -D - https://staging01.ktbyte.com/resources/dist/assets/images/logos/newnewlogo.png -o /dev/null | grep -i cache-control
cache-control: max-age=86400
cache-control: private, no-cache, must-revalidate
If I skip Caddy and access my server directly you can see the second line:
curl -sSL -D - http://staging01.ktbyte.com:4567/resources/dist/assets/images/logos/newnewlogo.png -o /dev/null | grep -i cache-control
Cache-Control: private, no-cache, must-revalidate
5. What I already tried:
I tried putting the route after file_server
, but that didn’t help. /resources is actually handled by the error_handler anyway.
I tried removing the header first, with header /resources/* -Cache-Control
. That didn’t help either.
6. Links to relevant resources:
I read the docs. They seem to say that if I did header /resources/* +Cache-Control max-age=86400
then I’d see the behaviour I’m getting - add a header, not replace it. But I don’t have the plus.