1. Caddy version (caddy version
): 2.3 (image: caddy:2.3.0-alpine)
a. System environment: Docker
d. My complete Caddyfile or JSON config:
api.domain.fi {
reverse_proxy strapi:1337
header /uploads/* Cache-Control max-age=31536000
}
3. The problem I’m having:
Strapi adds cache-control: max-age=0 header to it’s responses for static files in its uploads folder and I would like add cache for those files in api.domain.fi/uploads/ folder.
When I add header to Caddyfile header is added but also old one is kept and order is always so that 0 owerwrites 31536000 in browser.
Header added
header /uploads/* Cache-Control max-age=31536000
Header in Chrome dev tools
cache-control: max-age=31536000
cache-control: max-age=0
5. What I already tried:
I have tried to folllow docs header (Caddyfile directive) — Caddy Documentation and delete existing header and add a new one but then both headers are deleted. I have also tried to replace value for header but then no header exists in response. Using ? mark to add value if not yet exist doesn’t work either.
header -Cache-Control
header /uploads/* Cache-Control max-age=31536000
header /uploads/* Cache-Control max-age=0 max-age=31536000
header /uploads/* Cache-Control "max-age=0" "max-age=31536000"
header /uploads/* ?Cache-Control max-age=31536000