Case insensitive host rule

This commit is contained in:
Benjamin Gandon 2018-10-25 10:18:03 +02:00 committed by Traefiker Bot
parent 22ee8700ca
commit aa26927d61
4 changed files with 45 additions and 5 deletions

View file

@ -53,10 +53,10 @@ func (r *Rules) host(hosts ...string) *mux.Route {
})
}
func (r *Rules) hostRegexp(hosts ...string) *mux.Route {
func (r *Rules) hostRegexp(hostPatterns ...string) *mux.Route {
router := r.Route.Route.Subrouter()
for _, host := range hosts {
router.Host(strings.ToLower(host))
for _, hostPattern := range hostPatterns {
router.Host(hostPattern)
}
return r.Route.Route
}