mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-24 02:02:26 -04:00
headers: Allow nil HeaderOps (fix #6893)
Some checks failed
Lint / lint (macos-14, mac) (push) Waiting to run
Lint / lint (windows-latest, windows) (push) Waiting to run
Tests / test (./cmd/caddy/caddy, ~1.24.1, ubuntu-latest, 0, 1.24, linux) (push) Failing after 1m34s
Tests / test (s390x on IBM Z) (push) Has been skipped
Tests / goreleaser-check (push) Has been skipped
Lint / lint (ubuntu-latest, linux) (push) Successful in 1m54s
Lint / govulncheck (push) Successful in 1m14s
Tests / test (./cmd/caddy/caddy, ~1.24.1, macos-14, 0, 1.24, mac) (push) Has been cancelled
Tests / test (./cmd/caddy/caddy.exe, ~1.24.1, windows-latest, True, 1.24, windows) (push) Has been cancelled
Some checks failed
Lint / lint (macos-14, mac) (push) Waiting to run
Lint / lint (windows-latest, windows) (push) Waiting to run
Tests / test (./cmd/caddy/caddy, ~1.24.1, ubuntu-latest, 0, 1.24, linux) (push) Failing after 1m34s
Tests / test (s390x on IBM Z) (push) Has been skipped
Tests / goreleaser-check (push) Has been skipped
Lint / lint (ubuntu-latest, linux) (push) Successful in 1m54s
Lint / govulncheck (push) Successful in 1m14s
Tests / test (./cmd/caddy/caddy, ~1.24.1, macos-14, 0, 1.24, mac) (push) Has been cancelled
Tests / test (./cmd/caddy/caddy.exe, ~1.24.1, windows-latest, True, 1.24, windows) (push) Has been cancelled
This commit is contained in:
parent
39262f8663
commit
af2d33afbb
@ -78,7 +78,7 @@ func (h Handler) Validate() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if h.Response != nil {
|
if h.Response != nil && h.Response.HeaderOps != nil {
|
||||||
err := h.Response.validate()
|
err := h.Response.validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -133,6 +133,9 @@ type HeaderOps struct {
|
|||||||
|
|
||||||
// Provision sets up the header operations.
|
// Provision sets up the header operations.
|
||||||
func (ops *HeaderOps) Provision(_ caddy.Context) error {
|
func (ops *HeaderOps) Provision(_ caddy.Context) error {
|
||||||
|
if ops == nil {
|
||||||
|
return nil // it's possible no ops are configured; fix #6893
|
||||||
|
}
|
||||||
for fieldName, replacements := range ops.Replace {
|
for fieldName, replacements := range ops.Replace {
|
||||||
for i, r := range replacements {
|
for i, r := range replacements {
|
||||||
if r.SearchRegexp == "" {
|
if r.SearchRegexp == "" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user