Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Adding date and time to ASM response pages

pinkzeppelin
Altostratus
Altostratus

Hi,

How can we add exact date and time when blocking occurs to ASM response pages? 

Thanks.

1 ACCEPTED SOLUTION

Daniel_Wolf
Nacreous
Nacreous

Hi @pinkzeppelin,

this iRule should do:

 

when ASM_REQUEST_DONE {
   set asm_support_id [ASM::support_id]
}

when ASM_REQUEST_BLOCKING {
   
   HTTP::header remove Content-Length
   HTTP::header insert header_1 value_1

   set response "<html>
                     <head>
                        <title>Request Rejected</title>
                     </head>
                     <body>
                        The requested URL was rejected. Please consult with your administrator.<br><br>
                        The current time and date is: [clock format [clock seconds] -format {%H:%M:%S}], [clock format [clock seconds] -format {%d/%m/%Y}]<br><br>
                        Your support ID is: $asm_support_id<br><br><a href='javascript&colon;history.back();'>Go Back</a><br><br>


                     </body>
                  </html>"
   ASM::payload replace 0 [ASM::payload length] ""
   ASM::payload replace 0 0 $response
}

 

Make sure to enable Trigger ASM iRule Events in your ASM security policy.
For further reading check:
K22017023: Configuring a custom Blocking Response Page using an iRule and
tcl man page - Time and Date - clock 

KR
Daniel

View solution in original post

1 REPLY 1

Daniel_Wolf
Nacreous
Nacreous

Hi @pinkzeppelin,

this iRule should do:

 

when ASM_REQUEST_DONE {
   set asm_support_id [ASM::support_id]
}

when ASM_REQUEST_BLOCKING {
   
   HTTP::header remove Content-Length
   HTTP::header insert header_1 value_1

   set response "<html>
                     <head>
                        <title>Request Rejected</title>
                     </head>
                     <body>
                        The requested URL was rejected. Please consult with your administrator.<br><br>
                        The current time and date is: [clock format [clock seconds] -format {%H:%M:%S}], [clock format [clock seconds] -format {%d/%m/%Y}]<br><br>
                        Your support ID is: $asm_support_id<br><br><a href='javascript&colon;history.back();'>Go Back</a><br><br>


                     </body>
                  </html>"
   ASM::payload replace 0 [ASM::payload length] ""
   ASM::payload replace 0 0 $response
}

 

Make sure to enable Trigger ASM iRule Events in your ASM security policy.
For further reading check:
K22017023: Configuring a custom Blocking Response Page using an iRule and
tcl man page - Time and Date - clock 

KR
Daniel