yes, you can use data group and class command.
class wiki
https://devcentral.f5.com/wiki/irules.class.ashx
e.g.
[root@ve10:Active] config b class badreferer_class list
class badreferer_class {
{
"BadReferer.com"
"badman.com"
}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
set referrer_host [URI::host [HTTP::header value Referer]]
log local0. "\[HTTP::uri\]: [HTTP::uri]"
log local0. "\[HTTP::header value Referer\]: [HTTP::header value Referer]"
log local0. "\[URI::host [HTTP::header value Referer]\]: [URI::host [HTTP::header value Referer]]"
if { [class match -- $referrer_host equals badreferer_class] } {
HTTP::redirect http://BadReferer.com/image.jpg
}
}
}
[root@ve10:Active] config curl -I http://172.28.19.79 -H "Referer: http://BadReferer.com/something"
HTTP/1.0 302 Found
Location: http://BadReferer.com/image.jpg
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve10:Active] config curl -I http://172.28.19.79 -H "Referer: http://badman.com/something"
HTTP/1.0 302 Found
Location: http://BadReferer.com/image.jpg
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve10:Active] config tail /var/log/ltm
Jul 6 09:05:15 local/tmm info tmm[5111]: Rule myrule : [HTTP::uri]: /
Jul 6 09:05:15 local/tmm info tmm[5111]: Rule myrule : [HTTP::header value Referer]: http://BadReferer.com/something
Jul 6 09:05:15 local/tmm info tmm[5111]: Rule myrule : [URI::host http://BadReferer.com/something]: BadReferer.com
Jul 6 09:05:20 local/tmm info tmm[5111]: Rule myrule : [HTTP::uri]: /
Jul 6 09:05:20 local/tmm info tmm[5111]: Rule myrule : [HTTP::header value Referer]: http://badman.com/something
Jul 6 09:05:20 local/tmm info tmm[5111]: Rule myrule : [URI::host http://badman.com/something]: badman.com