Re: [PATCH 1/1] snapshot::web Fix internal redirects to farm
Hi,
On 11/19/24 10:21 AM, MOESSBAUER, Felix wrote:
> They are definitely not - as we know by now.
Indeed mlm-01 gets a relative one, lw-07 gets an absolute one. Because
of this:
> AliasMatch "^/file/([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{36})$" "/srv/snapshot.debian.org/farm/$1/$2/$1$2$3"
> <% if ['snapshot-mlm-01', 'sallinen'].include?(@trusted['hostname']) -%>
> # we temporarily and manually enabled mod proxy in apache
> SSLProxyEngine on
> RewriteCond %{REQUEST_URI} "^/file/[0-9a-f]{40}"
> RewriteCond "/srv/snapshot.debian.org/farm/$1/$2/$1$2$3" !-f
> #RewriteRule "^/file/([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{36})$" - [G]
> RewriteRule "^/file/([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{36})$" https://snapshot-lw07.debian.org/file/$1$2$3 [P]
> <% end -%>
>
That one does not trigger on lw07 because that's the only host this rule
redirects to. So lw07 has divergent behavior. :/
One point I'd make is that we could cache better with the redirect in
place: The cache can keep the file by-hash for multiple snapshot
timestamps - because it'd be kept by /file/hash key. Assuming that
people request similar debs from different snapshot timestamps.
If we knew what the filename(s) were (which should be kinda unique in
the Debian world!?[1]), we could add a Content-Disposition[2] to send
the filename to the browser.
In that spirit maybe it'd be nice to pass the filename to /file/ - e.g.
/file/hash?filename=hello_1.0-1_all.deb - and then add a
Content-Disposition header. That'd still not break the object caching.
Of course it might be that apt would be unhappy about that, no idea.
I understand that the motivation was to get the qps down. I think the
more useful metric here would be to avoid the spinning rust seek that's
required to serve the file - given that the request itself is kinda
cheap for snapshot (AIUI). OTOH hot files are probably just going to be
in the page cache anyway (even though that one is thrown away on reboot).
Kind regards
Philipp Kern
[1] For a given version, given that the version is part of the deb etc.
[2]
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#as_a_response_header_for_the_main_body
Reply to: