Skip to content

Commit

Permalink
add stale-while-revalidate and stale-if-error headers to cpan.mc.org
Browse files Browse the repository at this point in the history
  • Loading branch information
ranguard committed Jun 1, 2015
1 parent a9a47b9 commit 5af2db5
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -28,12 +28,13 @@ location ~ /authors/id/[^/]+$ {
location ~ /authors/.*/.*$ {
# files in author directories, basically the
# other regexes are above are the exceptions for this rule
add_header Surrogate-Control max-age=31104000;
# See: https://www.fastly.com/blog/stale-while-revalidate/
add_header Surrogate-Control max-age=31104000, stale-while-revalidate=31104000, stale-if-error=31104000;
}
location ~ /robots.txt$ {
# robots gets requested a lot - let fastly cache
# for an hour
add_header Surrogate-Control max-age=3600;
# for an hour, revalidate in the background (up to a day) and serve from cache if error revalidating
add_header Surrogate-Control max-age=3600, stale-while-revalidate=86400, stale-if-error=31104000;
}
location ~ /authors/ {
# anything else
Expand Down

0 comments on commit 5af2db5

Please sign in to comment.