Forum Discussion

SDO's avatar
Icon for Nimbostratus rankNimbostratus
Feb 14, 2024

Manage custom response page with Irules


I'm trying to manage custom response page following http response code and violations.

I'm using irule in Normal mode for each policy


I don't know why but my rule don't catch anything, I used the example given by F5


First example for http 500 blocked

         set asm_support_id [ASM::support_id]
         set client_ip [IP::client_addr]
    if {[ASM::violation names] contains "VIOL_HTTP_RESPONSE_STATUS" and {[HTTP::status] == 500 }}
        log local0. "VIOLATION_500 detected"
        set response "<html>
            <title>Request rejected by the server</title>
            Internal error.Please contact your administrator<br><br>
            Your support ID : $asm_support_id
            Your ip : $client_ip
        ASM::payload replace 0 [ASM::payload length] ""
        ASM::payload replace 0 0 $response


Is there something that miss


2 Replies

  • Hi,

    You need to follow the next steps:

    1. Make sure that "Trigger ASM iRule Events" option is enabled in the policy properties.
      1. Navigate to Security  ››  Application Security : Policy : Policy Properties.
      2. Change to the correct "Current edited security policy"

    You can review my original post too for more info.

    • SDO's avatar
      Icon for Nimbostratus rankNimbostratus

      Hello thanks for reply

      As i said i've already set Trigger ASM iRule Events to Normal in my policy. Do you see a syntax error maybe ?