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, 17:15 UTC
headers: Make ApplyTo nil-safe (#7426)
Tom Paulus committed
Jan 6, 2026 at 14:39 UTC
6a571428964aead1470d42eab105cfd57bc68783
1 file changed
+4
-1
modules/caddyhttp/headers/headers.go
+4
-1
@@ -217,7 +217,10 @@ type RespHeaderOps struct {
217
}
218
219
// ApplyTo applies ops to hdr using repl.
220
-func (ops HeaderOps) ApplyTo(hdr http.Header, repl *caddy.Replacer) {
220
+func (ops *HeaderOps) ApplyTo(hdr http.Header, repl *caddy.Replacer) {
221
+ if ops == nil {
222
+ return
223
+ }
224
// before manipulating headers in other ways, check if there
225
// is configuration to delete all headers, and do that first
226
// because if a header is to be added, we don't want to delete