From 354631bd2525a12dea8c51b337ee028309e7cb7c Mon Sep 17 00:00:00 2001 From: Jacob Coffee Date: Mon, 30 Sep 2024 14:21:05 -0500 Subject: [PATCH] feat(infra): do not cache static 404s (#2622) * feat(infra): do not cache static 404s * feat(infra): apply condition --- infra/cdn/main.tf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/infra/cdn/main.tf b/infra/cdn/main.tf index e7aa77108..059fd8977 100644 --- a/infra/cdn/main.tf +++ b/infra/cdn/main.tf @@ -68,6 +68,14 @@ resource "fastly_service_vcl" "python_org" { ttl = 0 } + cache_setting { + action = "pass" + cache_condition = "Don't cache 404s for /static" + name = "No caching for /static 404s" + stale_ttl = 0 + ttl = 0 + } + condition { name = "Force Pass No-Cache No-Store" priority = 10 @@ -129,6 +137,13 @@ resource "fastly_service_vcl" "python_org" { type = "REQUEST" } + condition { + name = "Don't cache 404s for /static" + priority = 10 + statement = "req.url ~ \"^/static/\" && beresp.status == 404" + type = "CACHE" + } + gzip { name = "Default rules" content_types = [