1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 12:31:58 +00:00

fix SubdomainRedirect on loopbacks

fix: https://github.com/kataras/iris/issues/1584#issuecomment-674001454
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-08-14 14:14:29 +03:00
parent dc35391ceb
commit 9f0872719f
3 changed files with 38 additions and 17 deletions

View File

@@ -112,6 +112,10 @@ func (s *subdomainRedirectWrapper) Wrapper(w http.ResponseWriter, r *http.Reques
host := context.GetHost(r)
root := s.root()
if loopback := netutil.GetLoopbackSubdomain(root); loopback != "" {
root = strings.Replace(root, loopback, context.GetDomain(host), 1)
}
// println("root: " + root)
hasSubdomain := host != root
if !hasSubdomain && !s.isFromRoot {