Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zemaj committed Jun 13, 2024
1 parent a16532d commit f76b872
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@ func (p *Proxy) proxyHTTPRequest(
roundTripReq.Header.Set("Connection", "keep-alive")
}

// Handle GOAWAY frame to correctly retry a request
if roundTripReq.Body != nil {
roundTripReq.GetBody = func() (io.ReadCloser, err error) {
if err.Error() == "http2: Transport received Server's graceful shutdown GOAWAY" {
return roundTripReq.Body, nil
}
return nil, err
}
}

// Set the User-Agent as an empty string if not provided to avoid inserting golang default UA
if roundTripReq.Header.Get("User-Agent") == "" {
roundTripReq.Header.Set("User-Agent", "")
Expand Down

0 comments on commit f76b872

Please sign in to comment.