mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-07-04 01:00:59 +02:00
allow wildcard hosts in whitelist
This commit is contained in:
parent
3c72d0b5ca
commit
6402de6349
1 changed files with 4 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
|
@ -127,6 +128,9 @@ func (p *Proxy) allowed(u *url.URL) bool {
|
||||||
if u.Host == host {
|
if u.Host == host {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if strings.HasPrefix(host, "*.") && strings.HasSuffix(u.Host, host[2:]) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue