1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 12:31:58 +00:00
This commit is contained in:
Gerasimos (Makis) Maropoulos
2023-08-31 13:05:08 +03:00
parent 29637dad2a
commit b8d84b7767
3 changed files with 10 additions and 3 deletions

View File

@@ -186,6 +186,13 @@ func ResolveVHost(addr string) string {
if idx := strings.IndexByte(addr, ':'); idx == 0 {
// only port, then return the 0.0.0.0
return /* "0.0.0.0" */ "localhost" + addr[idx:]
} else if idx > 0 { // if 0.0.0.0:80 let's just convert it to localhost.
if addr[0:idx] == "0.0.0.0" {
if addr[idx:] == ":80" {
return "localhost"
}
return "localhost" + addr[idx:]
}
}
// with ':' in order to not replace the ipv6 loopback addresses