Skip to content
Open
Changes from 3 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
19 changes: 19 additions & 0 deletions terraform/cache.tf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add comment(s) to tge relevant part of this file explaining what we've learned about the is-404 codepath?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes will do

Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ resource "fastly_service_vcl" "cache" {
type = "REQUEST"
}

condition {
name = "is-nar"
priority = 10
statement = "req.url ~ \"^/nar/\""
type = "CACHE"
}

domain {
name = "cache.nixos.org"
}
Expand Down Expand Up @@ -239,6 +246,18 @@ resource "fastly_service_vcl" "cache" {
status = 404
}

cache_setting {
name = "cache-404"
cache_condition = "is-404"
ttl = 86400 # 1 day
}

cache_setting {
name = "cache-nar"
cache_condition = "is-nar"
ttl = 31557600 # the maximum. 1 year
}

# Authenticate Fastly<->S3 requests. See Fastly documentation:
# https://docs.fastly.com/en/guides/amazon-s3#using-an-amazon-s3-private-bucket
snippet {
Expand Down