diff options
author | Mohammed Al Sahaf <msaa1990@gmail.com> | 2023-08-05 23:30:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-05 23:30:02 +0200 |
commit | 65e33fc1ee4798bb3450f6e291bfc88404982636 (patch) | |
tree | 6df2a4fc05295246c3cb9ab412fbe6d2828be8fd /modules/caddyhttp/reverseproxy/command.go | |
parent | 9f34383c02f1691e54280285a6499893fcbbb4c7 (diff) |
reverseproxy: do not parse upstream address too early if it contains replaceble parts (#5695)
* reverseproxy: do not parse upstream address too early if it contains replaceble parts
* remove unused method
* cleanup
* accommodate partially replaceable port
Diffstat (limited to 'modules/caddyhttp/reverseproxy/command.go')
-rw-r--r-- | modules/caddyhttp/reverseproxy/command.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/caddyhttp/reverseproxy/command.go b/modules/caddyhttp/reverseproxy/command.go index 48fabd5..8438b72 100644 --- a/modules/caddyhttp/reverseproxy/command.go +++ b/modules/caddyhttp/reverseproxy/command.go @@ -132,14 +132,14 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) { toAddresses := make([]string, len(to)) var toScheme string for i, toLoc := range to { - addr, scheme, err := parseUpstreamDialAddress(toLoc) + addr, err := parseUpstreamDialAddress(toLoc) if err != nil { return caddy.ExitCodeFailedStartup, fmt.Errorf("invalid upstream address %s: %v", toLoc, err) } - if scheme != "" && toScheme == "" { - toScheme = scheme + if addr.scheme != "" && toScheme == "" { + toScheme = addr.scheme } - toAddresses[i] = addr + toAddresses[i] = addr.dialAddr() } // proceed to build the handler and server |