Skip to content

Commit 28a6b16

Browse files
authored
Merge pull request #584 from NixOS/nixpkgs-tarball
simplify the tarball lock protocol
2 parents 7c8f6d7 + e635ceb commit 28a6b16

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

terraform/channels.tf

+5-8
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,11 @@ resource "fastly_service_vcl" "channels" {
238238
set beresp.grace = 0s;
239239
set beresp.cacheable = false;
240240
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);
249246
}
250247
return (pass);
251248
}

0 commit comments

Comments
 (0)