mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-01-30 16:26:16 +00:00
Fix handling of IPv6 addresses in getClientIP
This commit is contained in:
parent
19873e5b9e
commit
cdf6922bdd
1 changed files with 2 additions and 2 deletions
|
@ -249,9 +249,9 @@ class UptimeKumaServer {
|
||||||
|
|
||||||
return (typeof forwardedFor === "string" ? forwardedFor.split(",")[0].trim() : null)
|
return (typeof forwardedFor === "string" ? forwardedFor.split(",")[0].trim() : null)
|
||||||
|| socket.client.conn.request.headers["x-real-ip"]
|
|| socket.client.conn.request.headers["x-real-ip"]
|
||||||
|| clientIP.replace(/^.*:/, "");
|
|| clientIP.replace(/^::ffff:/, "");
|
||||||
} else {
|
} else {
|
||||||
return clientIP.replace(/^.*:/, "");
|
return clientIP.replace(/^::ffff:/, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue