Forum Discussion
Albert_252822
Aug 22, 2016Nimbostratus
ASM iRule events not working
Hi all,
I activated this irule in my Virtual Server:
when HTTP_REQUEST {
set redirect 0
set requri [HTTP::uri]
}
when ASM_REQUEST_BLOCKING {
set redirect 1
}
when HTTP_RESPONSE {...
Hannes_Rapp
Nimbostratus
Have not tested, but in theory, this should do what you want:
when ASM_REQUEST_DONE {
if { [ASM::status] equals "blocked" } {
switch -glob [string tolower [HTTP::path]] {
"/url1*" {
ASM::unblock
HTTP::respond 302 Location "https://url1/index" Connection Close
}
"/url2*" {
ASM::unblock
HTTP::respond 302 Location "https://url2/index" Connection Close
}
"/url3*" {
ASM::unblock
HTTP::respond 302 Location "https://url3/index" Connection Close
}
default { }
}
}
}
Hannes_Rapp
Aug 23, 2016Nimbostratus
I can just recommend to check /var/log/ltm - are there any iRule processing tcl errors? Make sure this iRule has priority by moving it first in the list of order, or use the 'priority' function.
Also note that if possible to invoke a redirect from ASM_REQUEST_BLOCKING event, rather use the sample Stanislas posted. This possibility varies across BigIP versions.
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