How to avoid Slowloris DoS Attack? #3337
Unanswered
josecelano
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Relates to: tokio-rs/axum#2716
Does ActixWeb close a connection if the client sends no requests after opening the connection?
I want to know if there is a timeout for this case:
I've seen 4 options in the configuration:
https://docs.rs/actix-web/latest/actix_web/struct.HttpServer.html#method.client_request_timeout
I guess what I'm looking for is something like client_request_timeout. However, it seems that the timeout requires that the client starts sending the headers for the first request. What happens if the client does not send any headers at all?
I've created a sample repo to reproduce the setup described above:
https://github.com/josecelano/axum-server-timeout
The client:
This is the output:
Despite waiting 15 seconds before sending the first request, the server doesn't close the connection. The client receives a
HTTP/1.1 408 Request Timeout
for the first request. However, I would expect the connection to be closed.I guess, two things are happening (I would like to confirm that):
On the other hand, when I use telnet instead of my example, it seems to work as I expect. If I set a
client_request_timeout
to 5 seconds:When I use telnet:
After 5 seconds, the connection is closed, and I receive the
HTTP/1.1 408 Request Timeout
.I can even make a request by sending these headers:
And after 5 seconds of not sending any request, the connection is closed, and I receive the
HTTP/1.1 408 Request Timeout
.How can I receive the
HTTP/1.1 408 Request Timeout
if I'm not sending any requests?Beta Was this translation helpful? Give feedback.
All reactions