0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00

allow wildcard hosts in whitelist

This commit is contained in:
Will Norris 2013-12-26 19:36:18 -08:00
parent 3c72d0b5ca
commit 6402de6349

View file

@ -24,6 +24,7 @@ import (
"net/http"
"net/url"
"reflect"
"strings"
"time"
"github.com/golang/glog"
@ -127,6 +128,9 @@ func (p *Proxy) allowed(u *url.URL) bool {
if u.Host == host {
return true
}
if strings.HasPrefix(host, "*.") && strings.HasSuffix(u.Host, host[2:]) {
return true
}
}
return false