summaryrefslogtreecommitdiff
path: root/modules/caddyhttp
diff options
context:
space:
mode:
authorJason McCallister <themccallister@gmail.com>2020-10-29 15:51:42 -0400
committerGitHub <noreply@github.com>2020-10-29 13:51:42 -0600
commitc9fdff9976da38c650a51cd3fb4f2667853ff627 (patch)
tree2343019b017c73a977e40bcb20150a1a140d1b39 /modules/caddyhttp
parentdb4f1c02772dfd1f50bd745b322be1b60c72ac41 (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/caddyhttp')
-rw-r--r--modules/caddyhttp/reverseproxy/caddyfile.go4
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"
}
}