Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(infra): do not cache static 404s #2622

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
ewdurbin marked this conversation as resolved.
Show resolved Hide resolved
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