Skip to content

Commit b9981c4

Browse files
committed
fix: add http.NewRequest error handler
1 parent 64ff8d2 commit b9981c4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

modsecurity.go

+5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ func (a *Modsecurity) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
7070

7171
proxyReq, err := http.NewRequest(req.Method, url, bytes.NewReader(body))
7272

73+
if err != nil {
74+
http.Error(rw, err.Error(), http.StatusBadRequest)
75+
return
76+
}
77+
7378
// We may want to filter some headers, otherwise we could just use a shallow copy
7479
// proxyReq.Header = req.Header
7580
proxyReq.Header = make(http.Header)

0 commit comments

Comments
 (0)