Forum Discussion

Abed_AL-R's avatar
Abed_AL-R
Icon for Cirrostratus rankCirrostratus
Jun 10, 2020

combining two irules into one irule

Hi

I want to be sure if I can combine those two iRules into one and if I'm using the correct order of conditions:

when ASM_REQUEST_DONE {

if { [HTTP::uri] starts_with "/myurl.php/" && [ASM::violation count] <= 4 } {

    if { [ASM::violation_data] contains "VIOLATION_OBJ_TYPE"} {
        ASM::unblock
    }
}
else {
     return
}
}

And this iRule:

when ASM_REQUEST_DONE {

if { [HTTP::uri] starts_with "/my/url/1.php" } {
   ASM::unblock
    }
}

Combined into this one:

when ASM_REQUEST_DONE {

if { [HTTP::uri] starts_with "/myurl.php/" && [ASM::violation count] <= 4 } {

    if { [ASM::violation_data] contains "VIOLATION_OBJ_TYPE"} {
        ASM::unblock
    }
} elseif
    { [HTTP::uri] starts_with "/my/url/1.php" } {
        ASM::unblock
}
else {
     return
}
}
  • Hello,

    It sounds good for me.

    Anyway, think you can remove the Else block since you don't have code at the end to skip with return command.

     

    Regards