mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-09 23:24:07 -08:00
feat: get client ip from x-forwarded-for header if available
Useful for use-cases where Uptime Kuma is running behind a reverse proxy
This commit is contained in:
parent
ed1f88a852
commit
6f01a448ad
|
@ -1677,7 +1677,8 @@ async function shutdownFunction(signal) {
|
|||
}
|
||||
|
||||
function getClientIp(socket) {
|
||||
return socket.client.conn.remoteAddress.replace(/^.*:/, "");
|
||||
return socket.client.conn.request.headers["x-forwarded-for"]
|
||||
|| socket.client.conn.remoteAddress.replace(/^.*:/, "");
|
||||
}
|
||||
|
||||
/** Final function called before application exits */
|
||||
|
|
Loading…
Reference in a new issue