Skip to content

Commit e83a46b

Browse files
don't log any sensitive information
1 parent 2005741 commit e83a46b

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

proxy/proxy.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -273,21 +273,21 @@ func (p *Server) forwardRequest(conn net.Conn, req *http.Request, https bool) {
273273
RawQuery: req.URL.RawQuery,
274274
}
275275

276-
var requestBodyBytes []byte
277-
{
278-
var err error
279-
requestBodyBytes, err = io.ReadAll(req.Body)
280-
if err != nil {
281-
p.logger.Error("can't read response body", "error", err)
282-
return
283-
}
284-
err = req.Body.Close()
285-
if err != nil {
286-
p.logger.Error("Failed to close HTTP response body", "error", err)
287-
return
288-
}
289-
req.Body = io.NopCloser(bytes.NewBuffer(requestBodyBytes))
290-
}
276+
//var requestBodyBytes []byte
277+
//{
278+
// var err error
279+
// requestBodyBytes, err = io.ReadAll(req.Body)
280+
// if err != nil {
281+
// p.logger.Error("can't read response body", "error", err)
282+
// return
283+
// }
284+
// err = req.Body.Close()
285+
// if err != nil {
286+
// p.logger.Error("Failed to close HTTP response body", "error", err)
287+
// return
288+
// }
289+
// req.Body = io.NopCloser(bytes.NewBuffer(requestBodyBytes))
290+
//}
291291

292292
var body = req.Body
293293
if req.Method == http.MethodGet || req.Method == http.MethodHead {
@@ -322,12 +322,12 @@ func (p *Server) forwardRequest(conn net.Conn, req *http.Request, https bool) {
322322
p.logger.Debug("Forwarded Request",
323323
"method", newReq.Method,
324324
"host", newReq.Host,
325-
"requestBodyBytes", string(requestBodyBytes),
325+
//"requestBodyBytes", string(requestBodyBytes),
326326
"URL", newReq.URL,
327327
)
328-
for hKey, hVal := range newReq.Header {
329-
p.logger.Debug("Forwarded Request Header", hKey, hVal)
330-
}
328+
//for hKey, hVal := range newReq.Header {
329+
// p.logger.Debug("Forwarded Request Header", hKey, hVal)
330+
//}
331331

332332
// Read the body and explicitly set Content-Length header, otherwise client can hung up on the request.
333333
bodyBytes, err := io.ReadAll(resp.Body)
@@ -351,7 +351,7 @@ func (p *Server) forwardRequest(conn net.Conn, req *http.Request, https bool) {
351351
"error", err,
352352
"host", req.Host,
353353
"method", req.Method,
354-
"bodyBytes", string(bodyBytes),
354+
//"bodyBytes", string(bodyBytes),
355355
)
356356
return
357357
}

0 commit comments

Comments
 (0)