From 3c53e87df71a5acdd4390e85c10a1f5ce78b4063 Mon Sep 17 00:00:00 2001 From: Alexey Mozzhakov Date: Sat, 23 Jun 2018 19:00:13 +0300 Subject: [PATCH 1/2] Fix for domains localhost.* and 127.0.0.1.* --- modules/http_proxy_base.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/http_proxy_base.go b/modules/http_proxy_base.go index 38ba658f..88bd96f6 100644 --- a/modules/http_proxy_base.go +++ b/modules/http_proxy_base.go @@ -97,7 +97,7 @@ func (p *HTTPProxy) doProxy(req *http.Request) bool { } for _, blacklisted := range blacklist { - if strings.HasPrefix(req.Host, blacklisted) { + if req.Host == blacklisted { log.Error("Got request with blacklisted host: %s", req.Host) return false } From 18c74ce6ef4f4cf1b5b048cfb602f69f1ba77807 Mon Sep 17 00:00:00 2001 From: Alexey Mozzhakov Date: Sat, 23 Jun 2018 19:17:16 +0300 Subject: [PATCH 2/2] Fix for requests with port specified --- modules/http_proxy_base.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/http_proxy_base.go b/modules/http_proxy_base.go index 88bd96f6..86816471 100644 --- a/modules/http_proxy_base.go +++ b/modules/http_proxy_base.go @@ -97,7 +97,7 @@ func (p *HTTPProxy) doProxy(req *http.Request) bool { } for _, blacklisted := range blacklist { - if req.Host == blacklisted { + if strings.Split(req.Host, ":")[0] == blacklisted { log.Error("Got request with blacklisted host: %s", req.Host) return false }