diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2019-06-12 19:13:54 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-06-12 19:13:54 +0300 |
commit | 02558f71efd57858d9301416964769f2896e62fd (patch) | |
tree | cea042a08686ef075d8ea047599a927fceb74a31 /internal/domain | |
parent | c6555c057a745608f8150ee7c7f3625c270bc301 (diff) |
Resolve "Pages incorrectly serve acme-challenges with /index.html"
Diffstat (limited to 'internal/domain')
-rw-r--r-- | internal/domain/domain.go | 6 | ||||
-rw-r--r-- | internal/domain/domain_test.go | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/internal/domain/domain.go b/internal/domain/domain.go index 4ce8a561..eeb5519d 100644 --- a/internal/domain/domain.go +++ b/internal/domain/domain.go @@ -186,6 +186,12 @@ func (d *D) HasAcmeChallenge(token string) bool { return true } + _, err = d.resolvePath(d.projectName, ".well-known/acme-challenge", token, "index.html") + + if err == nil { + return true + } + return false } diff --git a/internal/domain/domain_test.go b/internal/domain/domain_test.go index a05dbe7e..14e399ad 100644 --- a/internal/domain/domain_test.go +++ b/internal/domain/domain_test.go @@ -226,6 +226,16 @@ func TestHasAcmeChallenge(t *testing.T) { expected: true, }, { + name: "Project containing acme challenge", + domain: &D{ + group: group{name: "group.acme"}, + projectName: "with.acme.challenge", + config: &domainConfig{HTTPSOnly: true}, + }, + token: "foldertoken", + expected: true, + }, + { name: "Project containing another token", domain: &D{ group: group{name: "group.acme"}, |