Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions proxy/round_tripper/proxy_round_tripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,12 @@ func (rt *roundTripper) RoundTrip(originalRequest *http.Request) (*http.Response
}

// if the client disconnects before response is sent then return context.Canceled (499) instead of the gateway error
if err != nil && originalRequest.Context().Err() == context.Canceled && err != context.Canceled {
if err != nil && errors.Is(originalRequest.Context().Err(), context.Canceled) && !errors.Is(err, context.Canceled) {
rt.logger.Error("gateway-error-and-original-request-context-cancelled", zap.Error(err))
err = originalRequest.Context().Err()
originalRequest.Body.Close()
if originalRequest.Body != nil {
_ = originalRequest.Body.Close()
}
}

// If we have an error from the round trip, we prefer it over errors
Expand Down