[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/03: nginx: mirror: Honor upstream's 'Cache-Control' headers.
From: |
Ludovic Courtès |
Subject: |
01/03: nginx: mirror: Honor upstream's 'Cache-Control' headers. |
Date: |
Mon, 28 Aug 2017 09:17:06 -0400 (EDT) |
civodul pushed a commit to branch master
in repository maintenance.
commit 10b27972a4348ce13f9d79c6e68cc9574e0128fe
Author: Ludovic Courtès <address@hidden>
Date: Mon Aug 28 15:10:19 2017 +0200
nginx: mirror: Honor upstream's 'Cache-Control' headers.
'guix publish -C' does the right thing, so trust it.
* hydra/nginx/mirror-locations.conf (.narinfo): Remove
most 'proxy_cache_valid' and 'proxy_ignore_headers' directives.
---
hydra/nginx/mirror-locations.conf | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/hydra/nginx/mirror-locations.conf
b/hydra/nginx/mirror-locations.conf
index 9278331..34ab3f9 100644
--- a/hydra/nginx/mirror-locations.conf
+++ b/hydra/nginx/mirror-locations.conf
@@ -72,29 +72,20 @@ location ~ \.narinfo$ {
proxy_read_timeout 2s;
proxy_send_timeout 2s;
- # Enable caching for narinfo files, to avoid recomputing nar signatures.
- #
- # Note: Avoid caching narinfos for too long to avoid a situation
- # where we have the narinfo but don't have the corresponding nar
- # and cannot have it.
+ # Cache for narinfo files. We assume that upstream runs 'guix
+ # publish' and provides 'Cache-Control' headers that we can just
+ # blindly honor.
proxy_cache narinfo;
- proxy_cache_valid 200 10d; # cache hits for 10 days
- proxy_cache_valid 504 5m; # timeout, when hydra.gnu.org is overloaded
- proxy_cache_valid any 10m; # cache misses/others for 10m
- # Use the above TTLs, not those advertised by hydra.gnu.org.
- proxy_ignore_headers Expires Cache-Control;
+ proxy_cache_valid 504 5m; # timeout, when hydra.gnu.org is overloaded
- # Add 'Expires' and 'Cache-Control' response headers so clients
- # such as 'guix substitute' know how long they can cache it.
- # Override the headers coming from hydra.gnu.org.
- proxy_hide_header Expires;
- proxy_hide_header Cache-Control;
+ # Advertise a shorter TTL than what upstream provides to be on the
+ # safe side.
expires 7d;
proxy_ignore_client_abort on;
- # We need to hide and ignore the Set-Cookie header
+ # We need to hide and ignore Hydra's Set-Cookie header
# to enable caching.
proxy_hide_header Set-Cookie;
proxy_ignore_headers Set-Cookie;