mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-09-10 20:26:19 +00:00
Merge branch 'main' of https://github.com/MrR4di0k4l/3x-ui
This commit is contained in:
commit
da3f6aa302
1 changed files with 4 additions and 6 deletions
|
@ -11,14 +11,12 @@ import (
|
|||
func DomainValidatorMiddleware(domain string) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
host := c.GetHeader("X-Forwarded-Host")
|
||||
if host == "" {
|
||||
host = c.GetHeader("X-Real-IP")
|
||||
}
|
||||
if host == "" {
|
||||
host = c.Request.Host
|
||||
if colonIndex := strings.LastIndex(host, ":"); colonIndex != -1 {
|
||||
host, _, _ = net.SplitHostPort(host)
|
||||
}
|
||||
}
|
||||
|
||||
if colonIndex := strings.LastIndex(host, ":"); colonIndex != -1 {
|
||||
host, _, _ = net.SplitHostPort(host)
|
||||
}
|
||||
|
||||
if host != domain {
|
||||
|
|
Loading…
Reference in a new issue