Is it possible to change the key to something else instead of IP address?
In my case, middleware adds the logged in user to each request, so it would be nice if I could use req.user._id as key instead of IP. Even better if this could be a function where I can let it fall back to IP address when req.user is null.
This is just incase multiple users are behind the same IP address and want them to hit the limiter for no reason.
I like your suggestion, it's definitely useful. But as I'm currently on holiday, I can't implement this right now. I am however more than happy to accept a pull request!
Is it possible to change the key to something else instead of IP address?
In my case, middleware adds the logged in
user
to each request, so it would be nice if I could usereq.user._id
as key instead of IP. Even better if this could be a function where I can let it fall back to IP address whenreq.user
is null.This is just incase multiple users are behind the same IP address and want them to hit the limiter for no reason.