Fix host/method rule matching + tests

This commit is contained in:
Thom Seddon
2019-05-07 14:16:38 +01:00
parent 6f3ac5efe5
commit d1b12e4ffb
3 changed files with 151 additions and 18 deletions

View File

@ -276,6 +276,12 @@ func NewRule() *Rule {
}
}
func (r *Rule) formattedRule() string {
// Traefik implements their own "Host" matcher and then offers "HostRegexp"
// to invoke the mux "Host" matcher. This ensures the mux version is used
return strings.ReplaceAll(r.Rule, "Host(", "HostRegexp(")
}
func (r *Rule) Validate() {
if r.Action != "auth" && r.Action != "allow" {
log.Fatal("invalid rule action, must be \"auth\" or \"allow\"")