fixed real address grabbing

This commit is contained in:
ari melody 2024-01-19 04:22:18 +00:00
parent 8f0651e3a0
commit 4296ad20c8
Signed by: ari
GPG key ID: CF99829C92678188

View file

@ -130,10 +130,10 @@ function log_request(req, res, time) {
}
function get_real_address(req) {
if (TRUSTED_PROXIES.indexOf(req.socket.localAddress) !== -1 && req.headers['x-forwarded-for']) {
if (TRUSTED_PROXIES.indexOf(req.connection.remoteAddress) !== -1 && req.headers['x-forwarded-for']) {
return req.headers['x-forwarded-for'];
}
return req.socket.localAddress;
return req.connection.remoteAddress;
}
const wss = new Websocket.Server({ server });