Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'web/middleware')
-rw-r--r--web/middleware/domainValidator.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/web/middleware/domainValidator.go b/web/middleware/domainValidator.go
index 3adb0f0f..2beecfdb 100644
--- a/web/middleware/domainValidator.go
+++ b/web/middleware/domainValidator.go
@@ -1,15 +1,15 @@
package middleware
import (
+ "net"
"net/http"
- "strings"
"github.com/gin-gonic/gin"
)
func DomainValidatorMiddleware(domain string) gin.HandlerFunc {
return func(c *gin.Context) {
- host := strings.Split(c.Request.Host, ":")[0]
+ host, _, _ := net.SplitHostPort(c.Request.Host)
if host != domain {
c.AbortWithStatus(http.StatusForbidden)