feat: get client ip from x-forwarded-for header if available

Useful for use-cases where Uptime Kuma is running behind a reverse proxy
pull/1827/head
theS1LV3R 2 years ago
parent ed1f88a852
commit 6f01a448ad
No known key found for this signature in database
GPG Key ID: 1DF76CB829DAE8D4

@ -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…
Cancel
Save