Skip to content

Commit 354631b

Browse files
authored
feat(infra): do not cache static 404s (#2622)
* feat(infra): do not cache static 404s * feat(infra): apply condition
1 parent 4c44d80 commit 354631b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

infra/cdn/main.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ resource "fastly_service_vcl" "python_org" {
6868
ttl = 0
6969
}
7070

71+
cache_setting {
72+
action = "pass"
73+
cache_condition = "Don't cache 404s for /static"
74+
name = "No caching for /static 404s"
75+
stale_ttl = 0
76+
ttl = 0
77+
}
78+
7179
condition {
7280
name = "Force Pass No-Cache No-Store"
7381
priority = 10
@@ -129,6 +137,13 @@ resource "fastly_service_vcl" "python_org" {
129137
type = "REQUEST"
130138
}
131139

140+
condition {
141+
name = "Don't cache 404s for /static"
142+
priority = 10
143+
statement = "req.url ~ \"^/static/\" && beresp.status == 404"
144+
type = "CACHE"
145+
}
146+
132147
gzip {
133148
name = "Default rules"
134149
content_types = [

0 commit comments

Comments
 (0)