summaryrefslogtreecommitdiff
path: root/caddytest/integration/autohttps_test.go
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2021-07-14 12:49:34 -0400
committerGitHub <noreply@github.com>2021-07-14 10:49:34 -0600
commit1c6c7714a38879f78c486fcb9c7c6e39fc39c6a5 (patch)
tree60aeef93150ebbd3b4b5c5654ca9a014111335c5 /caddytest/integration/autohttps_test.go
parent46d99aba854ce19d51a075c39a8747b4f2404743 (diff)
caddyhttp: Fix edgecase with auto HTTP->HTTPS logic (#4243)
Diffstat (limited to 'caddytest/integration/autohttps_test.go')
-rw-r--r--caddytest/integration/autohttps_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/caddytest/integration/autohttps_test.go b/caddytest/integration/autohttps_test.go
index 72968e9..a065b0d 100644
--- a/caddytest/integration/autohttps_test.go
+++ b/caddytest/integration/autohttps_test.go
@@ -103,3 +103,23 @@ func TestAutoHTTPRedirectsInsertedBeforeUserDefinedCatchAll(t *testing.T) {
tester.AssertGetResponse("http://foo.localhost:9080/", 200, "Foo")
tester.AssertGetResponse("http://baz.localhost:9080/", 200, "Baz")
}
+
+func TestAutoHTTPRedirectsInsertedBeforeUserDefinedCatchAllWithNoExplicitHTTPSite(t *testing.T) {
+ tester := caddytest.NewTester(t)
+ tester.InitServer(`
+ {
+ http_port 9080
+ https_port 9443
+ local_certs
+ }
+ http://:9080 {
+ respond "Foo"
+ }
+ bar.localhost {
+ respond "Bar"
+ }
+ `, "caddyfile")
+ tester.AssertRedirect("http://bar.localhost:9080/", "https://bar.localhost/", http.StatusPermanentRedirect)
+ tester.AssertGetResponse("http://foo.localhost:9080/", 200, "Foo")
+ tester.AssertGetResponse("http://baz.localhost:9080/", 200, "Foo")
+}