mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-09 13:02:33 +02:00
omit EOF and contextCanceled error on non-debug mode
This commit is contained in:
parent
31080edd59
commit
dd629f516b
1 changed files with 7 additions and 1 deletions
|
@ -224,7 +224,13 @@ var hopHeaders = []string{
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ReverseProxy) errorHandler(rw http.ResponseWriter, r *http.Request, err error, writeHeader bool) {
|
func (p *ReverseProxy) errorHandler(rw http.ResponseWriter, r *http.Request, err error, writeHeader bool) {
|
||||||
logger.Errorf("http proxy to %s failed: %s", r.URL.String(), err)
|
switch {
|
||||||
|
case errors.Is(err, context.Canceled),
|
||||||
|
errors.Is(err, io.EOF):
|
||||||
|
logger.Debugf("http proxy to %s error: %s", r.URL.String(), err)
|
||||||
|
default:
|
||||||
|
logger.Errorf("http proxy to %s error: %s", r.URL.String(), err)
|
||||||
|
}
|
||||||
if writeHeader {
|
if writeHeader {
|
||||||
rw.WriteHeader(http.StatusBadGateway)
|
rw.WriteHeader(http.StatusBadGateway)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue