Mark cache as private

This commit is contained in:
Star Brilliant
2017-10-04 16:44:42 +08:00
parent 235c40ef96
commit a03529d1fd

View File

@@ -201,7 +201,11 @@ func (s *Server) handlerFunc(w http.ResponseWriter, r *http.Request) {
}
if respJson.HaveTTL {
w.Header().Set("Cache-Control", "max-age=" + strconv.Itoa(int(respJson.LeastTTL)))
if ednsClientSubnet != "" {
w.Header().Set("Cache-Control", "public, max-age=" + strconv.Itoa(int(respJson.LeastTTL)))
} else {
w.Header().Set("Cache-Control", "private, max-age=" + strconv.Itoa(int(respJson.LeastTTL)))
}
w.Header().Set("Expires", respJson.EarliestExpires.Format(time.RFC1123))
}
w.Write(respStr)