mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
feat: add x-real-ip as a secondary header for client ip
Now allows both x-forwarded-for as well as x-real-ip to be used for the client ip, preferring x-forwarded-for
This commit is contained in:
parent
6f01a448ad
commit
0a368ff553
1 changed files with 2 additions and 1 deletions
|
@ -1677,7 +1677,8 @@ async function shutdownFunction(signal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getClientIp(socket) {
|
function getClientIp(socket) {
|
||||||
return socket.client.conn.request.headers["x-forwarded-for"]
|
return socket.client.conn.request.headers["x-forwarded-for"]
|
||||||
|
|| socket.client.conn.request.headers["x-real-ip"]
|
||||||
|| socket.client.conn.remoteAddress.replace(/^.*:/, "");
|
|| socket.client.conn.remoteAddress.replace(/^.*:/, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue