Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 12, 08:15 UTC
reverse_proxy: add placeholder http.reverse_proxy.retries (#6553)
* Add placeholder http.reverse_proxy.lb.retries * Renamed placeholder to http.reverse_proxy.retries
Steffen Busch committed
Aug 30, 2024 at 19:53 UTC
c050a37e1c3228708a6716c8971361134243e941
1 file changed
+4
modules/caddyhttp/reverseproxy/reverseproxy.go
+4
@@ -67,6 +67,7 @@ func init() {
67
// `{http.reverse_proxy.upstream.duration_ms}` | Same as 'upstream.duration', but in milliseconds.
68
// `{http.reverse_proxy.duration}` | Total time spent proxying, including selecting an upstream, retries, and writing response.
69
// `{http.reverse_proxy.duration_ms}` | Same as 'duration', but in milliseconds.
70
+// `{http.reverse_proxy.retries}` | The number of retries actually performed to communicate with an upstream.
71
type Handler struct {
72
// Configures the method of transport for the proxy. A transport
73
// is what performs the actual "round trip" to the backend.
@@ -443,6 +444,9 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyht
444
retries++
445
}
446
447
+ // number of retries actually performed
448
+ repl.Set("http.reverse_proxy.retries", retries)
449
+
450
if proxyErr != nil {
451
return statusError(proxyErr)
452
}