Forum Discussion
Thomas_Leroy
Nimbostratus
Mar 16, 2018Block URL iRule
Hi,
I try to block URL based on the DNS request :
when DNS_REQUEST {if {[class match [DNS::question name] contains "URL_blocking"] } {
log local0. "website blocked [DNS::question name]"
DNS::...
Thomas_Leroy
Nimbostratus
Mar 20, 2018For those interested, this is the best solution I found :
when DNS_REQUEST {
set lower [string tolower [DNS::question name]]
set q_name_label_split [split $lower "."]
set q_name_label [lindex $q_name_label_split end-1]
if {[class match $q_name_label equals "URL_blocking"] }{
log local0. "website blocked [DNS::question name] <$q_name_label> $q_name_label $lower"
DNS::header rcode NXDOMAIN
DNS::return
}
}
I split the request and get the domain to compare to my list
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
