Skip to content

Commit

Permalink
keep backend status code in log even in case of response validation e…
Browse files Browse the repository at this point in the history
…rror (#21)
  • Loading branch information
Johannes Koch authored and Marcel Ludwig committed Dec 8, 2020
1 parent da841a7 commit 796a3f3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion logging/access_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,12 @@ func (log *AccessLog) ServeHTTP(rw http.ResponseWriter, req *http.Request, nextH
var err error
if isUpstreamRequest && roundtripInfo != nil {
err = roundtripInfo.Err
fields["status"] = 0
if roundtripInfo.BeResp != nil {
fields["timings"] = timings
fields["status"] = roundtripInfo.BeResp.StatusCode
timings["ttlb"] = roundMS(serveDone.Sub(timeTTFB))
} else {
fields["status"] = 0
fields["scheme"] = reqCtx.URL.Scheme
}
} else if !isUpstreamRequest {
Expand Down

0 comments on commit 796a3f3

Please sign in to comment.