[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH 1/1] snapshot::web Fix internal redirects to farm



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:

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.

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". =)

Kind regards and thanks for the brainstorming and keeping me honest
Philipp Kern

[1] https://www.fastly.com/blog/best-practices-using-vary-header


Reply to: