diff options
author | Matt Holt <mholt@users.noreply.github.com> | 2020-10-13 10:35:20 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-13 10:35:20 -0600 |
commit | c7efb0307d425eb533885e314518c370a06763da (patch) | |
tree | dfebe5f16db89c4e8f458c7fdbef5d55cd768277 /modules/caddyhttp/reverseproxy/reverseproxy.go | |
parent | e34d9f1244439a01a195febd966c7c5d88c98d33 (diff) |
reverseproxy: Fix dial placeholders, SRV, active health checks (#3780)
* reverseproxy: Fix dial placeholders, SRV, active health checks
Supercedes #3776
Partially reverts or updates #3756, #3693, and #3695
* reverseproxy: add integration tests
Co-authored-by: Mohammed Al Sahaf <msaa1990@gmail.com>
Diffstat (limited to 'modules/caddyhttp/reverseproxy/reverseproxy.go')
-rw-r--r-- | modules/caddyhttp/reverseproxy/reverseproxy.go | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go index eac02b6..305a0b3 100644 --- a/modules/caddyhttp/reverseproxy/reverseproxy.go +++ b/modules/caddyhttp/reverseproxy/reverseproxy.go @@ -129,10 +129,8 @@ func (h *Handler) Provision(ctx caddy.Context) error { h.ctx = ctx h.logger = ctx.Logger(h) - // get validation out of the way + // verify SRV compatibility for i, v := range h.Upstreams { - // Having LookupSRV non-empty conflicts with 2 other config parameters: active health checks, and upstream dial address. - // Therefore if LookupSRV is empty, then there are no immediately apparent config conflicts, and the iteration can be skipped. if v.LookupSRV == "" { continue } @@ -219,18 +217,6 @@ func (h *Handler) Provision(ctx caddy.Context) error { // set up upstreams for _, upstream := range h.Upstreams { - if upstream.LookupSRV == "" { - addr, err := caddy.ParseNetworkAddress(upstream.Dial) - if err != nil { - return err - } - - if addr.PortRangeSize() != 1 { - return fmt.Errorf("multiple addresses (upstream must map to only one address): %v", addr) - } - - upstream.networkAddress = addr - } // create or get the host representation for this upstream var host Host = new(upstreamHost) existingHost, loaded := hosts.LoadOrStore(upstream.String(), host) @@ -292,8 +278,6 @@ func (h *Handler) Provision(ctx caddy.Context) error { // then use it, otherwise use the port of upstream. if h.HealthChecks.Active.Port != 0 { upstream.activeHealthCheckPort = h.HealthChecks.Active.Port - } else { - upstream.activeHealthCheckPort = int(upstream.networkAddress.StartPort) } } |