Forum Discussion
Bob_10976
Mar 26, 2012Nimbostratus
Blocking Specific User-Agent
Hello all,
I'm attempting to block any traffic that comes in with the User-Agent that contains github.com/tenderlove/mechanize. Using the fourms I came up with the below iRule, however I'm gett...
hooleylist
Mar 26, 2012Cirrostratus
Hi Bob,
You need square braces around the HTTP::header command:
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: User-Agent: [string tolower [HTTP::header "User-Agent"]] requested [HTTP::host][HTTP::uri]"
if { [string tolower [HTTP::header "User-Agent"]] contains "github.com/tenderlove/mechanize"} {
log local0. "[IP::client_addr]:[TCP::client_port]: Rejected request"
reject
}
}
Aaron
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects