1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 10:27:06 +00:00
Former-commit-id: de1a500475a9d6f96e86445cfb9e85a57a65d1c2
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-01-05 18:27:21 +02:00
parent 3d358a4867
commit 79a965ec2d
4 changed files with 10 additions and 5 deletions

View File

@@ -157,7 +157,7 @@ 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" + addr[idx:]
return /* "0.0.0.0" */ "localhost" + addr[idx:]
}
// with ':' in order to not replace the ipv6 loopback addresses
@@ -215,5 +215,9 @@ func ResolveSchemeFromVHost(vhost string) string {
// and returns its URL, pure implementation but it does the job.
func ResolveURL(scheme string, addr string) string {
host := ResolveVHost(addr)
if host == "0.0.0.0" {
host = "localhost"
}
return scheme + "://" + host
}