Skip to content

Commit

Permalink
feat(infra): do not cache static 404s (#2622)
Browse files Browse the repository at this point in the history
* feat(infra): do not cache static 404s

* feat(infra): apply condition
  • Loading branch information
JacobCoffee authored Sep 30, 2024
1 parent 4c44d80 commit 354631b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions infra/cdn/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = [
Expand Down

0 comments on commit 354631b

Please sign in to comment.