mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 10:41:03 +01:00
minor
This commit is contained in:
parent
9f0872719f
commit
d0d7679a98
|
@ -910,7 +910,6 @@ func GetDomain(hostport string) string {
|
||||||
host = tmp
|
host = tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
// has port.
|
|
||||||
switch host {
|
switch host {
|
||||||
case "127.0.0.1", "0.0.0.0", "::1", "[::1]", "0:0:0:0:0:0:0:0", "0:0:0:0:0:0:0:1":
|
case "127.0.0.1", "0.0.0.0", "::1", "[::1]", "0:0:0:0:0:0:0:0", "0:0:0:0:0:0:0:1":
|
||||||
// loopback.
|
// loopback.
|
||||||
|
|
|
@ -38,12 +38,11 @@ var IsLoopbackSubdomain = func(s string) bool {
|
||||||
// GetLoopbackSubdomain returns the part of the loopback subdomain.
|
// GetLoopbackSubdomain returns the part of the loopback subdomain.
|
||||||
func GetLoopbackSubdomain(s string) string {
|
func GetLoopbackSubdomain(s string) string {
|
||||||
if strings.HasPrefix(s, "127.0.0.1:") || s == "127.0.0.1" ||
|
if strings.HasPrefix(s, "127.0.0.1:") || s == "127.0.0.1" ||
|
||||||
strings.HasPrefix(s, "0.0.0.0:") || s == "0.0.0.0" /* let's resolve that without regex (see below)*/ {
|
strings.HasPrefix(s, "0.0.0.0:") || s == "0.0.0.0" {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
ss := loopbackSubRegex.FindString(s)
|
return loopbackSubRegex.FindString(s)
|
||||||
return ss
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsLoopbackHost tries to catch the local addresses when a developer
|
// IsLoopbackHost tries to catch the local addresses when a developer
|
||||||
|
|
|
@ -115,7 +115,7 @@ func (s *subdomainRedirectWrapper) Wrapper(w http.ResponseWriter, r *http.Reques
|
||||||
if loopback := netutil.GetLoopbackSubdomain(root); loopback != "" {
|
if loopback := netutil.GetLoopbackSubdomain(root); loopback != "" {
|
||||||
root = strings.Replace(root, loopback, context.GetDomain(host), 1)
|
root = strings.Replace(root, loopback, context.GetDomain(host), 1)
|
||||||
}
|
}
|
||||||
// println("root: " + root)
|
|
||||||
hasSubdomain := host != root
|
hasSubdomain := host != root
|
||||||
|
|
||||||
if !hasSubdomain && !s.isFromRoot {
|
if !hasSubdomain && !s.isFromRoot {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user