diff --git a/utils.go b/utils.go index cf3f945..8c032ab 100644 --- a/utils.go +++ b/utils.go @@ -81,10 +81,9 @@ func replaceHost(content, oldHost, newHost string, useSSL bool, proxyExternal bo return s } - if net.ParseIP(matchUrl.Hostname()) == nil { - if !hostNameRegexp.MatchString(matchUrl.Host) { - return s - } + // if host not a IP address or a valid domain name + if net.ParseIP(matchUrl.Hostname()) == nil && !hostNameRegexp.MatchString(matchUrl.Hostname()) { + return s } // overide url in query diff --git a/utils_test.go b/utils_test.go index b1524d6..605b22b 100644 --- a/utils_test.go +++ b/utils_test.go @@ -141,6 +141,15 @@ var a=m;window.W_jd=window.W_jd||{};for(var b=0;b