How to fix "too many bad requests, block" error?
Server started to return blank white page occasionally. Restarting the server will fix the issue temporarily. Investigated the last snippet of log file before the restarting and found the following error:
2015-07-01 16:41:11.611 [INFO] [X.X.X.X:49248-0] Status 400: Bad request method: Connection: Close 2015-07-01 16:41:11.611 [INFO] [X.X.X.X:49249-0] Status 400: Bad request method: Connection: Close 2015-07-01 16:41:11.611 [INFO] [X.X.X.X:49250-0] Status 400: Bad request method: Connection: Close 2015-07-01 16:41:11.611 [INFO] [X.X.X.X:49251-0] Status 400: Bad request method: Connection: Close 2015-07-01 16:41:11.611 [NOTICE] [X.X.X.X:49251-0] too many bad requests, block. 2015-07-01 16:41:11.611 [NOTICE] [X.X.X.X] bot detected, close connection!
What happened?
Some poor script running on that server were sending bad HTTP requests starting with something like
"Connection: Close\r\n"
while it should start with request line like
"GET / HTTP/1.1\r\n"
LSWS will block that IP if it is geting too many bad requests.
Actually it is an security setting in LiteSpeed Block Bad Requests. It can be turned on or off as you wish.