Skip to content

Commit

Permalink
reverseproxy: default to port 80 for port-less upstream dial addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammed90 committed Oct 1, 2020
1 parent fdfdc03 commit 40ca4a4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions caddytest/integration/reverseproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ import (
"github.com/caddyserver/caddy/v2/caddytest"
)

func TestBareUpstream(t *testing.T) {
tester := caddytest.NewTester(t)
tester.InitServer(`
whoami.domain.me {
reverse_proxy whoami
}
app.domain.me {
reverse_proxy app:80
}
`, "caddyfile")
}

func TestReverseProxyHealthCheck(t *testing.T) {
tester := caddytest.NewTester(t)
tester.InitServer(`
Expand Down
3 changes: 3 additions & 0 deletions modules/caddyhttp/reverseproxy/caddyfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
if err != nil {
host = upstreamAddr
}
if port == "" {
port = "80"
}
}

// the underlying JSON does not yet support different
Expand Down

0 comments on commit 40ca4a4

Please sign in to comment.