summaryrefslogtreecommitdiffhomepage
path: root/caddytest/integration/autohttps_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'caddytest/integration/autohttps_test.go')
-rw-r--r--caddytest/integration/autohttps_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/caddytest/integration/autohttps_test.go b/caddytest/integration/autohttps_test.go
new file mode 100644
index 000000000..62f172d2b
--- /dev/null
+++ b/caddytest/integration/autohttps_test.go
@@ -0,0 +1,22 @@
+package integration
+
+import (
+ "net/http"
+ "testing"
+
+ "github.com/caddyserver/caddy/v2/caddytest"
+)
+
+func TestAutoHTTPtoHTTPSRedirects(t *testing.T) {
+ tester := caddytest.NewTester(t)
+ tester.InitServer(`
+ {
+ http_port 9080
+ https_port 9443
+ }
+ localhost:9443
+ respond "Yahaha! You found me!"
+ `, "caddyfile")
+
+ tester.AssertRedirect("http://localhost:9080/", "https://localhost/", http.StatusPermanentRedirect)
+}