mirror of
https://github.com/kataras/iris.git
synced 2026-01-09 04:51:56 +00:00
support multi-level subdomains redirect, see previous commit for the SubdomainRedirect fast solution
Former-commit-id: bc5749e46d1ae65f9d17063f3d8f2ea72510a9d8
This commit is contained in:
@@ -129,7 +129,10 @@ func hasSubdomain(s string) bool {
|
||||
// if not start with "/" then it should be something else,
|
||||
// we don't assume anything else but subdomain.
|
||||
slashIdx := strings.IndexByte(s, '/')
|
||||
return slashIdx > 0 || s[0] == SubdomainPrefix[0] || (len(s) >= 2 && s[0:2] == SubdomainWildcardIndicator)
|
||||
return slashIdx > 0 || // for route paths
|
||||
s[0] == SubdomainPrefix[0] || // for route paths
|
||||
(len(s) >= 2 && s[0:2] == SubdomainWildcardIndicator) || // for party rel path or route paths
|
||||
(len(s) >= 2 && slashIdx != 0 && s[len(s)-1] == '.') // for party rel, i.e www., or subsub.www.
|
||||
}
|
||||
|
||||
// splitSubdomainAndPath checks if the path has subdomain and if it's
|
||||
|
||||
Reference in New Issue
Block a user