GetSubdomainFull returns the full subdomain level, e.g. [test.user.]mydomain.com.
(r *http.Request)
| 1033 | // GetSubdomainFull returns the full subdomain level, e.g. |
| 1034 | // [test.user.]mydomain.com. |
| 1035 | func GetSubdomainFull(r *http.Request) string { |
| 1036 | host := GetHost(r) // host:port |
| 1037 | rootDomain := GetDomain(host) // mydomain.com |
| 1038 | rootDomainIdx := strings.Index(host, rootDomain) |
| 1039 | if rootDomainIdx == -1 { |
| 1040 | return "" |
| 1041 | } |
| 1042 | |
| 1043 | return host[0:rootDomainIdx] |
| 1044 | } |
| 1045 | |
| 1046 | // SubdomainFull returns the full subdomain level, e.g. |
| 1047 | // [test.user.]mydomain.com. |