nixpkgs-tarball-rework
https://github.com/NixOS/nixos-channel-scripts/pull/76#issuecomment-2718894977
Jörg Thalheim committed
Mar 12, 2025 at 20:50 UTC
e635ceb7d799b8e5599f00a33c1d48ea86197766
1 file changed
+5
-8
terraform/channels.tf
+5
-8
@@ -238,14 +238,11 @@ resource "fastly_service_vcl" "channels" {
238
set beresp.grace = 0s;
239
set beresp.cacheable = false;
240
if (req.backend.is_origin && std.suffixof(bereq.url, "/nixexprs.tar.xz")) {
241
- # rename prepared link header if available
242
- if (beresp.http.x-amz-meta-link) {
243
- set beresp.http.link = beresp.http.x-amz-meta-link;
244
- unset beresp.http.x-amz-meta-link;
245
- # otherwise, use fallback that contains no flake attributes (e.g. rev)
246
- } else {
247
- set beresp.http.link = "<" + beresp.http.location + {">; rel="immutable""};
248
- }
241
+ # pass redirect location into special flake "immutable tarball" header
242
+ set beresp.http.link = "<" + beresp.http.location + {">; rel="immutable""};
243
+ # clear query string from redirect destination as precaution in case
244
+ # legacy consumers can't handle flake attributes like "?rev=" in it
245
+ set beresp.http.location = querystring.remove(beresp.http.location);
246
}
247
return (pass);
248
}