@marcel91200 / caddy Mirror · read-only / commits / 84eaf50b
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 11, 01:00 UTC

admin: better Cache-Control handling (#8330)

Kévin Dunglas committed Nov 1, 2026 at 22:58 UTC 84eaf50b7bc91b3a565764f5a9f6d9f045151cee
2 files changed +5 -2
admin.go
+2 -1
@@ -45,6 +45,7 @@ import (
45 "github.com/prometheus/client_golang/prometheus"
46 "go.uber.org/zap"
47 "go.uber.org/zap/zapcore"
48 + "golang.org/x/net/http/httpguts"
49
50 "github.com/caddyserver/caddy/v2/caddyconfig/warning"
51 "github.com/caddyserver/caddy/v2/internal"
@@ -1085,7 +1086,7 @@ func handleConfig(w http.ResponseWriter, r *http.Request) error {
1086 body = buf.Bytes()
1087 }
1088
1088 - forceReload := r.Header.Get("Cache-Control") == "must-revalidate"
1089 + forceReload := httpguts.HeaderValuesContainsToken(r.Header["Cache-Control"], "must-revalidate")
1090
1091 err := changeConfig(r.Method, r.URL.Path, body, r.Header.Get("If-Match"), forceReload)
1092 if err != nil && !errors.Is(err, errSameConfig) {
caddyconfig/load.go
+3 -1
@@ -24,6 +24,8 @@ import (
24 "strings"
25 "sync"
26
27 + "golang.org/x/net/http/httpguts"
28 +
29 "github.com/caddyserver/caddy/v2"
30 )
31
@@ -107,7 +109,7 @@ func (adminLoad) handleLoad(w http.ResponseWriter, r *http.Request) error {
109 body = result
110 }
111
110 - forceReload := r.Header.Get("Cache-Control") == "must-revalidate"
112 + forceReload := httpguts.HeaderValuesContainsToken(r.Header["Cache-Control"], "must-revalidate")
113
114 err = caddy.Load(body, forceReload)
115 if err != nil {