From f36e0ce71ccd1ef9032e5a838750b1ee48cf2e2c Mon Sep 17 00:00:00 2001 From: Simon Marsh Date: Sat, 31 Oct 2020 12:01:23 +0000 Subject: [PATCH] Tweak cache parameters --- dnsapi.go | 2 +- regapi.go | 12 ++++++------ roaapi.go | 6 +++--- static.go | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dnsapi.go b/dnsapi.go index c4b9e22..7296a80 100644 --- a/dnsapi.go +++ b/dnsapi.go @@ -90,7 +90,7 @@ func dnsRZoneHandler(w http.ResponseWriter, r *http.Request) { } // cache for up to a day - w.Header().Set("Cache-Control", "public, max-age=86400, stale-if-error=86400") + w.Header().Set("Cache-Control", "public, max-age=7200, stale-if-error=86400") switch format[0] { case "bind": diff --git a/regapi.go b/regapi.go index 6b5e496..ad7ab9b 100644 --- a/regapi.go +++ b/regapi.go @@ -315,7 +315,7 @@ func regRootHandler(w http.ResponseWriter, r *http.Request) { } // cache for up to a day, but set etag to commit to catch changes - w.Header().Set("Cache-Control", "public, max-age=86400, stale-if-error=86400") + w.Header().Set("Cache-Control", "public, max-age=7200, stale-if-error=86400") w.Header().Set("ETag", RegistryData.Commit) ResponseJSON(w, response) @@ -352,7 +352,7 @@ func regTypeHandler(w http.ResponseWriter, r *http.Request) { } // cache for up to a day, but set etag to commit to catch changes - w.Header().Set("Cache-Control", "public, max-age=86400, stale-if-error=86400") + w.Header().Set("Cache-Control", "public, max-age=7200, stale-if-error=86400") w.Header().Set("ETag", RegistryData.Commit) ResponseJSON(w, response) @@ -421,7 +421,7 @@ func regObjectHandler(w http.ResponseWriter, r *http.Request) { } // cache for up to a day, but set etag to commit to catch changes - w.Header().Set("Cache-Control", "public, max-age=86400, stale-if-error=86400") + w.Header().Set("Cache-Control", "public, max-age=7200, stale-if-error=86400") w.Header().Set("ETag", RegistryData.Commit) ResponseJSON(w, response) @@ -443,7 +443,7 @@ func regObjectHandler(w http.ResponseWriter, r *http.Request) { } // cache for up to a day, but set etag to commit to catch changes - w.Header().Set("Cache-Control", "public, max-age=86400, stale-if-error=86400") + w.Header().Set("Cache-Control", "public, max-age=7200 stale-if-error=86400") w.Header().Set("ETag", RegistryData.Commit) ResponseJSON(w, response) @@ -498,7 +498,7 @@ func regKeyHandler(w http.ResponseWriter, r *http.Request) { } // cache for up to a day, but set etag to commit to catch changes - w.Header().Set("Cache-Control", "public, max-age=86400, stale-if-error=86400") + w.Header().Set("Cache-Control", "public, max-age=7200, stale-if-error=86400") w.Header().Set("ETag", RegistryData.Commit) ResponseJSON(w, amap) @@ -552,7 +552,7 @@ func regAttributeHandler(w http.ResponseWriter, r *http.Request) { } // cache for up to a day, but set etag to commit to catch changes - w.Header().Set("Cache-Control", "public, max-age=86400, stale-if-error=86400") + w.Header().Set("Cache-Control", "public, max-age=7200, stale-if-error=86400") w.Header().Set("ETag", RegistryData.Commit) ResponseJSON(w, amap) diff --git a/roaapi.go b/roaapi.go index bdf00c5..c5ceb98 100644 --- a/roaapi.go +++ b/roaapi.go @@ -131,7 +131,7 @@ func roaFilterHandler(w http.ResponseWriter, r *http.Request) { } // cache for up to a week, but set etag to commit to catch changes - w.Header().Set("Cache-Control", "public, max-age=604800, stale-if-error=86400") + w.Header().Set("Cache-Control", "public, max-age=7200, stale-if-error=604800") w.Header().Set("ETag", ROAData.Commit) ResponseJSON(w, filters) @@ -152,7 +152,7 @@ func roaJSONHandler(w http.ResponseWriter, r *http.Request) { } // cache for up to a week, but set etag to commit to catch changes - w.Header().Set("Cache-Control", "public, max-age=604800, stale-if-error=86400") + w.Header().Set("Cache-Control", "public, max-age=7200, stale-if-error=604800") w.Header().Set("ETag", ROAData.Commit) ResponseJSON(w, ROAJSONResponse) @@ -183,7 +183,7 @@ func roaBirdHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") // cache for up to a week, but set etag to commit to catch changes - w.Header().Set("Cache-Control", "public, max-age=604800, stale-if-error=86400") + w.Header().Set("Cache-Control", "public, max-age=7200, stale-if-error=604800") w.Header().Set("ETag", ROAData.Commit) fmt.Fprintf(w, "#\n# dn42regsrv ROA Generator\n# Last Updated: %s\n"+ diff --git a/static.go b/static.go index bd4a087..6da3029 100644 --- a/static.go +++ b/static.go @@ -58,7 +58,7 @@ func staticHandler(path string) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // allow up to a month of caching - w.Header().Set("Cache-Control", "public, max-age=2592000, stale-if-error=86400") + w.Header().Set("Cache-Control", "public, max-age=2592000, stale-if-error=2592000") server.ServeHTTP(w, r) }) }