diff options
author | Jason McCallister <themccallister@gmail.com> | 2020-10-29 15:51:42 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-29 13:51:42 -0600 |
commit | c9fdff9976da38c650a51cd3fb4f2667853ff627 (patch) | |
tree | 2343019b017c73a977e40bcb20150a1a140d1b39 /modules | |
parent | db4f1c02772dfd1f50bd745b322be1b60c72ac41 (diff) |
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 <mholt@users.noreply.github.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/caddyhttp/reverseproxy/caddyfile.go | 4 |
1 files changed, 3 insertions, 1 deletions
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" } } |