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 = [