Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

What's the purpose of the catch block in an ASM_REQUEST_BLOCKING scenario

We're returning custom ASM-error pages by using an irule whose initial structure follows the principle of the article ASM_REQUEST_BLOCKING.

Some month ago i decided to remove the last block 'when HTTP_RESPONSE_RELEASE'. Today i temporarily re-added it and was quite surprised about the log entries. Although the irule works as expected, the content of the catch block is getting executed.

How do i identify the typ of the exception thrown by the irule? And what action should it take in this case, since everything works fine?

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

You can use the more complete form of catch to return the resulting error:

if { [catch {
        #do only if  previous was event ASM_REQUEST_BLOCKING
        if { $activeViolation } {
            #modify respose header
            HTTP::header remove Content-Length
            HTTP::header insert header_1 value_1
        }
    } err] } {
    log local0. "Error is ${err}"
}

Ref: http://www.tcl.tk/man/tcl8.5/TclCmd/catch.htm

1