diff options
| author | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-08-08 11:52:59 +0300 |
|---|---|---|
| committer | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-08-08 18:39:12 +0300 |
| commit | 604b9be4a0deacb018d9a553003921fe230f31ed (patch) | |
| tree | ec93f0af9875c612b55bb177e93ea2942900216f /web | |
| parent | 7b8ef988469f5dfa943246641ba525d0352465b2 (diff) | |
Fix domain validation for Nginx/CDN compatibility #2450
Diffstat (limited to 'web')
| -rw-r--r-- | web/middleware/domainValidator.go | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/web/middleware/domainValidator.go b/web/middleware/domainValidator.go index 52d2782c..c94130c0 100644 --- a/web/middleware/domainValidator.go +++ b/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 { |
