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>
This commit is contained in:
Jason McCallister 2020-10-29 15:51:42 -04:00 committed by GitHub
parent db4f1c0277
commit c9fdff9976
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"
}
}