diff options
author | Matthew Holt <[email protected]> | 2019-10-11 14:25:39 -0600 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2019-10-11 14:25:39 -0600 |
commit | 1e31be8de0d1d5587348619225456a793cb30f7f (patch) | |
tree | fa3fca930b8ae02649471698950a60cce8afc539 /listeners.go | |
parent | 4aa3af4b78addcf65ce6b254be10f006bae1c9ac (diff) | |
download | caddy-1e31be8de0d1d5587348619225456a793cb30f7f.tar.gz caddy-1e31be8de0d1d5587348619225456a793cb30f7f.zip |
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.
Diffstat (limited to 'listeners.go')
-rw-r--r-- | listeners.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/listeners.go b/listeners.go index 04ec788f0..8c2792c26 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 } |