http_class to irule conversion

Does anyone know how to convert a http_class to an irule, the code it’s the below.

when HTTP_CLASS_SELECTED { if {[HTTP::class asm] == 1 } {

if {$disable_asm == 1 } {
        ASM::disable
    }
    else {
        ASM::enable
    }

} }

Hi Ayrton Miguel Salazar Cortes,

you may try the following syntax as a starting point…

when HTTP_REQUEST {
    set asm_policy "/Common/YOUR_ASM_POLICY"
    if { $asm_policy ne "" } then {
        ASM::enable $asm_policy
    } else {
        ASM::disable
    }
}

Note: Keep in mind that you have to assign at least one ASM_POLICY (could be a dummy policy) to your Virtual Server to execute theorcommands.

[ASM::enable]
[ASM::disable]

Cheers, Kai