Add denyHosts flag to deny URLs for certain hosts

For example, when running in a Docker swarm cluster we dont want it to
have access to our internal services available under *.weave.local

Closes #85
This commit is contained in:
yvind Ngai Johnsen 2017-03-23 10:42:39 +01:00 committed by Will Norris
parent 127a621c8a
commit 7264d177a1
3 changed files with 29 additions and 8 deletions

View file

@ -44,6 +44,7 @@ const defaultMemorySize = 100
var addr = flag.String("addr", "localhost:8080", "TCP address to listen on")
var allowHosts = flag.String("allowHosts", "", "comma separated list of allowed remote hosts")
var whitelist = flag.String("whitelist", "", "deprecated. use 'allowHosts' instead")
var denyHosts = flag.String("denyHosts", "", "comma separated list of denied remote hosts")
var referrers = flag.String("referrers", "", "comma separated list of allowed referring hosts")
var baseURL = flag.String("baseURL", "", "default base URL for relative remote URLs")
var cache tieredCache
@ -70,6 +71,9 @@ func main() {
if *allowHosts != "" {
p.AllowHosts = strings.Split(*allowHosts, ",")
}
if *denyHosts != "" {
p.DenyHosts = strings.Split(*denyHosts, ",")
}
if *referrers != "" {
p.Referrers = strings.Split(*referrers, ",")
}