retry only on real network errors
Now retries only happen when actual network errors occur and not only anymore based on the HTTP status code. This is because the backend could also send this status codes as their normal interface and in that case we don't want to retry.
This commit is contained in:
parent
131d8dd765
commit
f79317a435
6 changed files with 202 additions and 9 deletions
|
@ -595,6 +595,7 @@ func (server *Server) loadConfig(configurations configs, globalConfiguration Glo
|
|||
redirectHandlers := make(map[string]negroni.Handler)
|
||||
backends := map[string]http.Handler{}
|
||||
backendsHealthcheck := map[string]*healthcheck.BackendHealthCheck{}
|
||||
errorHandler := NewRecordingErrorHandler(middlewares.DefaultNetErrorRecorder{})
|
||||
|
||||
for _, configuration := range configurations {
|
||||
frontendNames := sortedFrontendNamesForConfig(configuration)
|
||||
|
@ -669,7 +670,12 @@ func (server *Server) loadConfig(configurations configs, globalConfiguration Glo
|
|||
// passing nil will use the roundtripper http.DefaultTransport
|
||||
rt := clientTLSRoundTripper(tlsConfig)
|
||||
|
||||
fwd, err := forward.New(forward.Logger(oxyLogger), forward.PassHostHeader(frontend.PassHostHeader), forward.RoundTripper(rt))
|
||||
fwd, err := forward.New(
|
||||
forward.Logger(oxyLogger),
|
||||
forward.PassHostHeader(frontend.PassHostHeader),
|
||||
forward.RoundTripper(rt),
|
||||
forward.ErrorHandler(errorHandler),
|
||||
)
|
||||
if err != nil {
|
||||
log.Errorf("Error creating forwarder for frontend %s: %v", frontendName, err)
|
||||
log.Errorf("Skipping frontend %s...", frontendName)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue