@cryptotaxi247 / infra-1 / commits / 310cb455

Revert "Fix negative caching for cache.nixos.org"

This reverts commit 40e0e539c2e4730dec595c9b73f1a540064f80ca.

Eelco Dolstra committed Jul 15, 2022 at 16:34 UTC 310cb455f6c2a06e24989f18cb441992d9e51907
1 file changed +10 -13
terraform/cache.tf
+10 -13
@@ -181,15 +181,14 @@ resource "fastly_service_v1" "cache" {
181 source = "\"*\""
182 }
183
184 - # Serve a smaller 404 response. Unfortunately, this breaks caching.
185 - #response_object {
186 - # name = "404-page"
187 - # cache_condition = "is-404"
188 - # content = "404"
189 - # content_type = "text/plain"
190 - # response = "Not Found"
191 - # status = 404
192 - #}
184 + response_object {
185 + name = "404-page"
186 + cache_condition = "is-404"
187 + content = "404"
188 + content_type = "text/plain"
189 + response = "Not Found"
190 + status = 404
191 + }
192
193 snippet {
194 content = "set req.url = querystring.remove(req.url);"
@@ -213,17 +212,15 @@ resource "fastly_service_v1" "cache" {
212 }
213
214 snippet {
216 - name = "cache-errors"
215 content = <<-EOT
216 if (beresp.status == 403) {
217 set beresp.status = 404;
220 - }
221 - if (beresp.status == 404) {
218 set beresp.ttl = 86400s;
223 - set beresp.stale_if_error = 3600s;
219 + set beresp.grace = 0s;
220 set beresp.cacheable = true;
221 }
222 EOT
223 + name = "Change 403 from S3 to 404"
224 priority = 100
225 type = "fetch"
226 }