Explorar el Código

Fix domain validation for Nginx/CDN compatibility #2450

mhsanaei hace 3 meses
padre
commit
604b9be4a0
Se han modificado 1 ficheros con 3 adiciones y 9 borrados
  1. 3 9
      web/middleware/domainValidator.go

+ 3 - 9
web/middleware/domainValidator.go

@@ -10,15 +10,9 @@ 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)
-			}
+		host := c.Request.Host
+		if colonIndex := strings.LastIndex(host, ":"); colonIndex != -1 {
+			host, _, _ = net.SplitHostPort(c.Request.Host)
 		}
 
 		if host != domain {