Tweak cache parameters
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c6a608061e
commit
f36e0ce71c
@ -90,7 +90,7 @@ func dnsRZoneHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cache for up to a day
|
// 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] {
|
switch format[0] {
|
||||||
case "bind":
|
case "bind":
|
||||||
|
12
regapi.go
12
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
|
// 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)
|
w.Header().Set("ETag", RegistryData.Commit)
|
||||||
|
|
||||||
ResponseJSON(w, response)
|
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
|
// 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)
|
w.Header().Set("ETag", RegistryData.Commit)
|
||||||
|
|
||||||
ResponseJSON(w, response)
|
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
|
// 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)
|
w.Header().Set("ETag", RegistryData.Commit)
|
||||||
|
|
||||||
ResponseJSON(w, response)
|
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
|
// 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)
|
w.Header().Set("ETag", RegistryData.Commit)
|
||||||
|
|
||||||
ResponseJSON(w, response)
|
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
|
// 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)
|
w.Header().Set("ETag", RegistryData.Commit)
|
||||||
|
|
||||||
ResponseJSON(w, amap)
|
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
|
// 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)
|
w.Header().Set("ETag", RegistryData.Commit)
|
||||||
|
|
||||||
ResponseJSON(w, amap)
|
ResponseJSON(w, amap)
|
||||||
|
@ -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
|
// 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)
|
w.Header().Set("ETag", ROAData.Commit)
|
||||||
|
|
||||||
ResponseJSON(w, filters)
|
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
|
// 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)
|
w.Header().Set("ETag", ROAData.Commit)
|
||||||
|
|
||||||
ResponseJSON(w, ROAJSONResponse)
|
ResponseJSON(w, ROAJSONResponse)
|
||||||
@ -183,7 +183,7 @@ func roaBirdHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||||
|
|
||||||
// cache for up to a week, but set etag to commit to catch changes
|
// 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)
|
w.Header().Set("ETag", ROAData.Commit)
|
||||||
|
|
||||||
fmt.Fprintf(w, "#\n# dn42regsrv ROA Generator\n# Last Updated: %s\n"+
|
fmt.Fprintf(w, "#\n# dn42regsrv ROA Generator\n# Last Updated: %s\n"+
|
||||||
|
@ -58,7 +58,7 @@ func staticHandler(path string) http.Handler {
|
|||||||
|
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
// allow up to a month of caching
|
// 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)
|
server.ServeHTTP(w, r)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user