Skip to content

Commit

Permalink
Fix handling of IPv6 addresses in getClientIP
Browse files Browse the repository at this point in the history
  • Loading branch information
n-thumann committed Jul 7, 2023
1 parent 19873e5 commit cdf6922
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/uptime-kuma-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:/, "");
}
}

Expand Down

0 comments on commit cdf6922

Please sign in to comment.