Simple DDOS Protection for HTTP Requests

Problem this snippet solves:

Here is a straight-forward example of how you can avoid a location specific DDOS attack via iRules. This iRule inspects the Accept-Language header to get an idea of the source of the attack, and filters based on that.

Code :

when HTTP_REQUEST {
  if { [HTTP::uri] equals "/" }{
    #log "uri: [HTTP::uri] "
    HTTP::redirect "http://anotherserverpool"
  } elseif { [HTTP::uri] equals "/homepage.asp" } {
    #log "uri: [HTTP::uri] "
    HTTP::redirect "http://anotherserverpool"
  } elseif {[string tolower [HTTP::header "Accept-Language"]] contains "ru"} {
    HTTP::redirect "http://nullsite"
  } else {
    pool mypool
  }
}
Published Mar 18, 2015
Version 1.0

Was this article helpful?

No CommentsBe the first to comment