debug: log host / path

to help understand why the ingress rule logged is being selected.

in addition, combine "Request Headers..." and "Serving with ingress..." logs
into this updated log.

Co-authored-by: Silver <sssilver@users.noreply.github.com>
This commit is contained in:
Daniel Hwang 2021-04-30 16:39:15 -07:00 committed by Silver
parent aca0c93461
commit f3b0b33dc5
1 changed files with 7 additions and 2 deletions

View File

@ -238,8 +238,13 @@ func (p *proxy) logRequest(r *http.Request, fields logFields) {
} else {
p.log.Debug().Msgf("All requests should have a CF-RAY header. Please open a support ticket with Cloudflare. %s %s %s ", r.Method, r.URL, r.Proto)
}
p.log.Debug().Msgf("CF-RAY: %s Request Headers %+v", fields.cfRay, r.Header)
p.log.Debug().Msgf("CF-RAY: %s Serving with ingress rule %v", fields.cfRay, fields.rule)
p.log.Debug().
Str("CF-RAY", fields.cfRay).
Fields(r.Header).
Str("host", r.Host).
Str("path", r.URL.Path).
Interface("rule", fields.rule).
Msg("Inbound request")
if contentLen := r.ContentLength; contentLen == -1 {
p.log.Debug().Msgf("CF-RAY: %s Request Content length unknown", fields.cfRay)