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, 14:30 UTC
Added a null check to avoid segfault on rewrite query ops (#6191)
Aziz Rmadi committed
Mar 23, 2024 at 00:51 UTC
db9d16735458be441abcb12b477d9d1fe630687e
1 file changed
+7
-5
modules/caddyhttp/rewrite/rewrite.go
+7
-5
@@ -117,13 +117,15 @@ func (rewr *Rewrite) Provision(ctx caddy.Context) error {
117
}
118
rep.re = re
119
}
120
-
121
- for _, replacementOp := range rewr.Query.Replace {
122
- err := replacementOp.Provision(ctx)
123
- if err != nil {
124
- return fmt.Errorf("compiling regular expression %s in query rewrite replace operation: %v", replacementOp.SearchRegexp, err)
120
+ if rewr.Query != nil {
121
+ for _, replacementOp := range rewr.Query.Replace {
122
+ err := replacementOp.Provision(ctx)
123
+ if err != nil {
124
+ return fmt.Errorf("compiling regular expression %s in query rewrite replace operation: %v", replacementOp.SearchRegexp, err)
125
+ }
126
}
127
}
128
+
129
return nil
130
}
131