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. --- listeners.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'listeners.go') diff --git a/listeners.go b/listeners.go index 04ec788..8c2792c 100644 --- a/listeners.go +++ b/listeners.go @@ -286,9 +286,10 @@ func JoinNetworkAddress(network, host, port string) string { if network != "" { a = network + "/" } - a += host - if port != "" { - a += ":" + port + if host != "" && port == "" { + a += host + } else if port != "" { + a += net.JoinHostPort(host, port) } return a } -- cgit v1.2.3