fix: user location fix
This commit is contained in:
+3
-3
@@ -32,9 +32,9 @@ func CountryFromCloudflare(r *http.Request) string {
|
||||
return cc
|
||||
}
|
||||
|
||||
// ClientIP returns the best guess at the caller's IP. The chi RealIP
|
||||
// middleware already rewrites r.RemoteAddr from X-Forwarded-For /
|
||||
// X-Real-IP, so we just strip the port.
|
||||
// ClientIP returns the best guess at the caller's IP. The middleware.RealIP
|
||||
// middleware already rewrites r.RemoteAddr to the real client (right-most
|
||||
// X-Forwarded-For entry from the trusted edge proxy), so we just strip any port.
|
||||
func ClientIP(r *http.Request) string {
|
||||
host, _, err := net.SplitHostPort(strings.TrimSpace(r.RemoteAddr))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user