caddy: File server missing Vary on 206, 304
I’m checking my caching headers for assets served by file server. It all works as expected, but RedBot claims it should be adding Vary when serving 206, 304.
I’ve checked Caddy site itself that it’s not some misconfiguration on my end, but it doesn’t seem to be, the case there seems even worse: https://redbot.org/?uri=https://caddyserver.com/resources/css/docs.css?v=dfd5278
It seems the Vary needs to be sent in both cases.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 38 (21 by maintainers)
Commits related to this issue
- encode: Improve Etag handling (fix #5849) We also improve Last-Modified handling in the file server. Both changes should be more compliant with RFC 9110. — committed to makesoftwaresafe/caddy by mholt 3 years ago
- fileserver: Improve Vary handling (#5849) — committed to caddyserver/caddy by mholt 3 years ago
- fileserver: Set "Vary: Accept-Encoding" header (see #5849) — committed to caddyserver/caddy by mholt 3 years ago
Yeah I saw it, sorry, just been busy working on the 2.8 release
I’m not testing locally. I am using the hosted instance against a Caddy instance on a VPS.
@mholt Both issues are present. My screenshots are on the latest commit @ master. The issue with Vary I already mentioned it in this comment. It is different to the one initially reported on this issue, which was fixed.
I’m not sure about the ETag one myself either, will check in a bit. However, the Vary error is not that. It’s that compressed responses send
Vary: Accept-Encoding, but uncompressed ones don’t send any Vary at all, when it should send the same header in all requests that can be encoded, whether they are or not.I’ll provide proper examples in a bit.
@mholt RedBot is OSS https://github.com/mnot/redbot you should be able to use it to lint against your local Caddy instance easily, I’m not sure if it provides a way to prepare copy/pastable curl requests.
If not, maybe a feature suggestion on the repo?
About your question, IMO the fix should be that 304 keeps the same
Vary200 would produce. TheETagone I’m not exactly sure.No problems, I didn’t interpret it as hostile, on the contrary: you’ve warned this might not be the best place for me to try getting into Go (and Caddy’s codebase) so I’ll find some other place to contribute, don’t worry. 👍 Thanks!
@mholt thanks, I’ll try to take a stab at it, it’s no rush since nobody complained until now. 😆
Hope the hospital sees the back of you ASAP, all the best with that, take care.