On Wed, 2024-11-20 at 16:47 +0100, Philipp Kern wrote: > On 11/20/24 3:48 PM, MOESSBAUER, Felix wrote: > > I had to re-learn Apache rules again as I'm also an Nginx user. > > Felt a bit like traveling 10 years into the past. > > Same. :) > > > > I.e. we could do literally what you suggested but key it off the > > > User-Agent and set the Vary header? > > > > Technically we can, but this significantly reduces the caching on > > Fastly, as we can't encode "cache for all, except if this user- > > agent". > > > > I have no idea how to properly resolve this. If someone more > > familiar > > with HTTP caching is reading this, please speak up. > > We basically own the whole stack (and Fastly allows ~arbitrary VCL). > I'd > be open to something like this:
Okay... That's good. > > Fastly matches on UA and inserts a header "X-Download-Directly: yes" > if > the UA is apt-cacher-ng, otherwise it will send "X-Download-Directly: > no". We sent a "Vary: X-Download-Directly" back. If you take care of the Fastly part, I'll update the local varnish VCL rules to handle the X-Download-Directly (I'll send the patch to this ML by EO today). > > The general guidance from Fastly[1] is to narrow the Vary header > content > down to a few cache keys. That'd be two. I think that'd be fine, as > it'd > only apply to files fetched by apt-cacher-ng where the caching would > then be worse. But that's better than being broken. And we could > still > patch apt-cacher-ng and fix it for the future - although then it'd be > cool if there would be a sane way to match on the UA to identify > fixed > versions. Like "apt-cacher-ng/version allow-redirects". =) The patch is already available, it just needs a proposed update upload: https://lists.debian.org/debian-snapshot/2024/10/msg00010.html Anyways, that's on your end. My rules will only care about the X- Download-Directly header. Best regards, Felix Moessbauer > > Kind regards and thanks for the brainstorming and keeping me honest > Philipp Kern > > [1] https://www.fastly.com/blog/best-practices-using-vary-header -- Siemens AG, Technology Linux Expert Center
