Skip to content

Commit

Permalink
reverseproxy: caddyfile: Don't add port if upstream has placeholder (#…
Browse files Browse the repository at this point in the history
…3819)

* check if the host is a placeholder

* Update modules/caddyhttp/reverseproxy/caddyfile.go

Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
  • Loading branch information
jasonmccallister and mholt authored Oct 29, 2020
1 parent db4f1c0 commit c9fdff9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/caddyhttp/reverseproxy/caddyfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Expand Down

0 comments on commit c9fdff9

Please sign in to comment.