wsanders_233261
Aug 24, 2017Nimbostratus
Catching an exception in irule for a nonexistent pool
How would I catch an exception for a nonexistent pool? I have this irule hardwired to return a 503:
when HTTP_REQUEST {
set HOST [ string tolower [HTTP::host] ]
set VALUE "/"
set MYPOOL [ call /Common/LIB-sac-dev::https_rule $HOST $VALUE ]
log local0.debug "HERE: Pool $MYPOOL Host $HOST Value $VALUE"
HTTP::respond 503 content "Pool \"$MYPOOL\" unavailable"
event disable
TCP::close
pool $MYPOOL
The call returns a pool name according to the host name in the header. If the host name doesn't match a pool, it returns the string "undefined". When MYPOOL exists, the rules correctly responds with a 503:
Unexpectedly, if the pool does not exist, the "pool" statement is evaluated, no 503 response occurs and the browser gets a 'connection reset' instead:
- no such pool: undefined (line 😎 invoked from within "pool $MYPOOL"
How could I send a 503 in response to a ltm rule that contains a reference to a nonexistent pool?