mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-10-30 11:24:14 +00:00
fix RATE_LIMIT_BY=ip to use req.ip instead of a client-controlled header (#568)
This commit is contained in:
1 parent
d657a0cb2d
commit
b16a6f9e16
1 file changed
+2
-1
@@ -144,7 +144,8 @@ const limiter = rateLimit({
|
||||
const token = req.headers.authorization?.split(' ')[1] || '127.0.0.1';
|
||||
return token;
|
||||
case 'ip':
|
||||
return req.headers['x-real-ip'];
|
||||
// req.ip (not a raw header) so this respects trust proxy and cannot be spoofed by the client
|
||||
return req.ip;
|
||||
default:
|
||||
return '127.0.0.1';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user