Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 12, 02:00 UTC
headers: Allow nil HeaderOps (fix #6893)
Matthew Holt committed
Mar 11, 2025 at 08:52 UTC
af2d33afbb52389cda139a6a0fd8a9d65f558676
1 file changed
+4
-1
modules/caddyhttp/headers/headers.go
+4
-1
@@ -78,7 +78,7 @@ func (h Handler) Validate() error {
78
return err
79
}
80
}
81
- if h.Response != nil {
81
+ if h.Response != nil && h.Response.HeaderOps != nil {
82
err := h.Response.validate()
83
if err != nil {
84
return err
@@ -133,6 +133,9 @@ type HeaderOps struct {
133
134
// Provision sets up the header operations.
135
func (ops *HeaderOps) Provision(_ caddy.Context) error {
136
+ if ops == nil {
137
+ return nil // it's possible no ops are configured; fix #6893
138
+ }
139
for fieldName, replacements := range ops.Replace {
140
for i, r := range replacements {
141
if r.SearchRegexp == "" {