It can be host or host:port.
In the latter case the check simply does not work.
It's not documented and it simply looks like a bug.
It should be using the Hostname function instead.
It seems this is not the only problem the var localHostIpv4 = regexp.MustCompile(127.0.0.\d+) matches everything that contains the 127.0.0. string say my127.0.0.foo.
It was originally observed in https://github.com/elazarl/goproxy/issues/289.
The
IsLocalHost
function usesreq.URL.Host
https://github.com/elazarl/goproxy/blob/a0805db90819b464f8fadc660e23a6a6b9d4942f/dispatcher.go#L105It can be host or host:port. In the latter case the check simply does not work. It's not documented and it simply looks like a bug. It should be using the Hostname function instead.