We already have a rule to let Varnish follow the 302 redirects from the /archive endpoint to the farm (/file) endpoint. This rule was not effective, though, as it assumed that the 302 redirects are absolute URIs (including the protocol and host part). We now change this to follow the realtive (internal) redirects, restoring this behavior.
A nice side-effect is that the artifacts are now delivered with the correct file-name (instead of the farm hash). Further it effectively cuts the number of http requests to s.d.o in half. Signed-off-by: Felix Moessbauer <[email protected]> --- Hi, this patch is based on https://salsa.debian.org/dsa-team/mirror/dsa-puppet/, as I can't find the correct upstream repository to contribute to. I hope one of the maintainers can pick it up. Xref: https://lists.debian.org/debian-snapshot/2024/11/msg00004.html Xref: https://salsa.debian.org/snapshot-team/snapshot/-/merge_requests/23 Best regards, Felix Moessbauer Siemens AG .../roles/templates/snapshot/snapshot.debian.org.vcl.erb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/roles/templates/snapshot/snapshot.debian.org.vcl.erb b/modules/roles/templates/snapshot/snapshot.debian.org.vcl.erb index e423dbe58..613415dc6 100644 --- a/modules/roles/templates/snapshot/snapshot.debian.org.vcl.erb +++ b/modules/roles/templates/snapshot/snapshot.debian.org.vcl.erb @@ -51,10 +51,9 @@ sub vcl_backend_response { if (bereq.http.host != "snapshot-dev.debian.org" && bereq.retries == 0 && beresp.status == 302 && - beresp.http.location ~ "https?://[^/]*/file/") { - set beresp.http.location = regsub(beresp.http.location,"^https?://",""); - set bereq.http.host = regsub(beresp.http.location,"/.*$",""); - set bereq.url = regsub(beresp.http.location,"[^/]*",""); + beresp.http.location ~ "^/file/") { + set bereq.http.host = beresp.http.host; + set bereq.url = beresp.http.location; return (retry); } # don't cache things too long -- 2.39.5
