From c9fdff9976da38c650a51cd3fb4f2667853ff627 Mon Sep 17 00:00:00 2001 From: Jason McCallister Date: Thu, 29 Oct 2020 15:51:42 -0400 Subject: reverseproxy: caddyfile: Don't add port if upstream has placeholder (#3819) * check if the host is a placeholder * Update modules/caddyhttp/reverseproxy/caddyfile.go Co-authored-by: Matt Holt --- modules/caddyhttp/reverseproxy/caddyfile.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/caddyhttp/reverseproxy/caddyfile.go b/modules/caddyhttp/reverseproxy/caddyfile.go index fcaf82b..193487a 100644 --- a/modules/caddyhttp/reverseproxy/caddyfile.go +++ b/modules/caddyhttp/reverseproxy/caddyfile.go @@ -155,7 +155,9 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { if err != nil { host = upstreamAddr } - if port == "" { + // we can assume a port if only a hostname is specified, but use of a + // placeholder without a port likely means a port will be filled in + if port == "" && !strings.Contains(host, "{") { port = "80" } } -- cgit v1.2.3