I think that question bears a little more looking into.
At the moment, I’m thinking it might be best just to include an example like this in the header
documentation:
route {
header Cache-Control max-age=3600
header /static/* Cache-Control max-age=31536000
header /favicon.ico Cache-Control max-age=31536000
}
And explain what the use case is for it.
This is an interesting case where the behaviour we’d usually expect to be ideal - that is, evaluating the more specific route first - is actually counterproductive for headers!
But it’s not feasible, I don’t think, to change Caddy to sort routes the opposite way around when path matchers that only have header handlers are in play. I can just imagine how hacky that’d be, and I can see edge cases galore…
So yeah, probably an update to the docs is at hand.