I am writing some anti DoS / brute force actix web middleware from which I would like to block some badly behaving clients. The blocking should be implemented by simply closing the client socket without sending any status or response to it. I found that this can be achieved by panic'ing in the handler but I wonder if there a more sound way of achieving the same goal.
Asked
Active
Viewed 116 times
0
-
1Why don't you want to return a 429? https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 – Njuguna Mureithi Jan 30 '22 at 15:43
-
@NjugunaMureithi, good to know such an error code exists. However; in some critical applications it a well established practice not to answer at all. – kyku Jan 30 '22 at 15:49
-
1I did think that was the case. I looked at https://github.com/TerminalWitchcraft/actix-ratelimit/blob/master/src/middleware.rs#L182 but it's the same approach. I am guessing as you said a panic should do it. – Njuguna Mureithi Jan 30 '22 at 16:07