summaryrefslogtreecommitdiff
path: root/caddytest
diff options
context:
space:
mode:
authorMatt Holt <mholt@users.noreply.github.com>2020-04-09 12:39:05 -0600
committerGitHub <noreply@github.com>2020-04-09 12:39:05 -0600
commitd89ad2fd5ba8de6dee0ff420458b634431da9b89 (patch)
treecebc04b573c13c02091dd2fc9b1ff60a0a5db8c5 /caddytest
parentd33926b63f088dcd680648a71ca3498cf6579532 (diff)
caddytls: Fix for TLS conn policy being applied to HTTP-only servers (#3243)
* httpcaddyfile: Don't add TLS policy to HTTP-only server (#3193, #3223) * Account for HTTP port * Add integration test written by @sarge
Diffstat (limited to 'caddytest')
-rw-r--r--caddytest/integration/sni_test.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/caddytest/integration/sni_test.go b/caddytest/integration/sni_test.go
index e48346d..f26131e 100644
--- a/caddytest/integration/sni_test.go
+++ b/caddytest/integration/sni_test.go
@@ -272,3 +272,46 @@ func TestDefaultSNIWithPortMappingOnly(t *testing.T) {
// makes a request with no sni
caddytest.AssertGetResponse(t, "https://127.0.0.1:9443/version", 200, "hello from a")
}
+
+func TestHttpOnlyOnDomainWithSNI(t *testing.T) {
+ caddytest.AssertAdapt(t, `
+ {
+ default_sni a.caddy.localhost
+ }
+ :80 {
+ respond /version 200 {
+ body "hello from localhost"
+ }
+ }
+ `, "caddyfile", `{
+ "apps": {
+ "http": {
+ "servers": {
+ "srv0": {
+ "listen": [
+ ":80"
+ ],
+ "routes": [
+ {
+ "match": [
+ {
+ "path": [
+ "/version"
+ ]
+ }
+ ],
+ "handle": [
+ {
+ "body": "hello from localhost",
+ "handler": "static_response",
+ "status_code": 200
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ }
+}`)
+}