terraform: enable segment caching for NAR files (#208)
This should fix the issue we're seeing in #207
Jonas Chevalier committed
Mar 17, 2022 at 11:55 UTC
f65ddaca22fb1f009d9bf5245aeda98b08d566ac
1 file changed
+14
terraform/cache.tf
+14
@@ -197,6 +197,20 @@ resource "fastly_service_v1" "cache" {
197
type = "recv"
198
}
199
200
+ # Work around the 2GB size limit for large files
201
+ #
202
+ # See https://docs.fastly.com/en/guides/segmented-caching
203
+ snippet {
204
+ content = <<-EOT
205
+ if (req.url.path ~ "^/nar/") {
206
+ set req.enable_segmented_caching = true;
207
+ }
208
+ EOT
209
+ name = "Enable segment caching for NAR files"
210
+ priority = 60
211
+ type = "recv"
212
+ }
213
+
214
snippet {
215
content = <<-EOT
216
if (beresp.status == 403) {