1
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2024-11-28 08:48:45 +02:00

Fix handling of IPv6 addresses in getClientIP

This commit is contained in:
nthumann 2023-07-07 23:38:10 +02:00
parent 19873e5b9e
commit cdf6922bdd
No known key found for this signature in database
GPG Key ID: 91AE26F52DE54B76

View File

@ -249,9 +249,9 @@ class UptimeKumaServer {
return (typeof forwardedFor === "string" ? forwardedFor.split(",")[0].trim() : null)
|| socket.client.conn.request.headers["x-real-ip"]
|| clientIP.replace(/^.*:/, "");
|| clientIP.replace(/^::ffff:/, "");
} else {
return clientIP.replace(/^.*:/, "");
return clientIP.replace(/^::ffff:/, "");
}
}