From 1e31be8de0d1d5587348619225456a793cb30f7f Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Fri, 11 Oct 2019 14:25:39 -0600 Subject: reverse_proxy: Allow dynamic backends (closes #990 and #1539) This PR enables the use of placeholders in an upstream's Dial address. A Dial address must represent precisely one socket after replacements. See also #998 and #1639. --- modules/caddyhttp/reverseproxy/healthchecks.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/caddyhttp/reverseproxy/healthchecks.go') diff --git a/modules/caddyhttp/reverseproxy/healthchecks.go b/modules/caddyhttp/reverseproxy/healthchecks.go index be532ea..a64c21d 100644 --- a/modules/caddyhttp/reverseproxy/healthchecks.go +++ b/modules/caddyhttp/reverseproxy/healthchecks.go @@ -115,7 +115,7 @@ func (h *Handler) doActiveHealthChecksForAllHosts() { // so use a fake Host value instead; unix sockets are usually local hostAddr = "localhost" } - err = h.doActiveHealthCheck(NewDialInfo(network, addrs[0]), hostAddr, host) + err = h.doActiveHealthCheck(DialInfo{Network: network, Address: addrs[0]}, hostAddr, host) if err != nil { log.Printf("[ERROR] reverse_proxy: active health check for host %s: %v", networkAddr, err) } @@ -259,7 +259,7 @@ func (h *Handler) countFailure(upstream *Upstream) { err := upstream.Host.CountFail(1) if err != nil { log.Printf("[ERROR] proxy: upstream %s: counting failure: %v", - upstream.dialInfo, err) + upstream.Dial, err) } // forget it later @@ -268,7 +268,7 @@ func (h *Handler) countFailure(upstream *Upstream) { err := host.CountFail(-1) if err != nil { log.Printf("[ERROR] proxy: upstream %s: expiring failure: %v", - upstream.dialInfo, err) + upstream.Dial, err) } }(upstream.Host, failDuration) } -- cgit v1.2.3