Forum Discussion
Mick39_201768
May 12, 2015Nimbostratus
Block HTTPS access from specific user agent
Dear community,
I want to block HTTPS access from specific user agent(UA).
I found this topic following,
https://devcentral.f5.com/questions/block-a-user-agent-with-an-irule
and I want some ide...
May 12, 2015
Try this:
when HTTPS_REQUEST {
log local0. "User-Agent:[HTTPS::header "User-Agent"]"
if { [string tolower [HTTPS::header "User-Agent"]] == "mozilla/4.0" && !([IP::addr [IP::client_addr] equals 1.1.1.1]) } {
drop
log local0. "Rejected request: [IP::remote_addr] User-Agent:[string tolower [HTTPS::header "User-Agent"]] requested [HTTPS::host][HTTP::uri]"
}
}
Replace 1.1.1.1 with whatever IP you want to allow. Please note that this rule require an SSL profile and an HTTP profile on the virtual server.
If you have multiple IP's it might be worth looking into a data group list.
Good luck!
/Patrik
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