nestjs-rate-limiter icon indicating copy to clipboard operation
nestjs-rate-limiter copied to clipboard

HTTP Request is undefined in WebSockets

Open stewartmcgown opened this issue 3 years ago • 3 comments

image This bit of code expects there to be an express request object always present on the context. For long lived websocket connections, this isn't always the case. We should be able to fall back to the Websocket's original connecting IP and handle the rate limiting that way. image

stewartmcgown avatar Apr 20 '21 16:04 stewartmcgown

thanks for letting me know, I will work on it soon. @stewartmcgown

onur-ozkan avatar Apr 20 '21 17:04 onur-ozkan

I'm not even sure if its possible to get access to the original request object at this point. If not, we may have to add an extra setup step for the websocket connection that stores the connecting IP somewhere

stewartmcgown avatar Apr 20 '21 22:04 stewartmcgown

This is essentially the same error I hit when reporting #41

smiley-uriux avatar Apr 26 '21 20:04 smiley-uriux