local traffic policies
1 TopicLocal traffic policies and irules together
Problem this snippet solves: Local traffic policies are very useful to define URL-based redirection, virtual servers and pool assignments, host header rewriting... But some actions can't be done with Local traffic policies and there are some deployments with both Policies and irules applied on the same VS. for HTTP_REQUEST event, Policies are executed before irules. If Policy action is http-reply redirect, the irule is executed but all HTTP changes raise TCL error (insert header, modify cookies, URI rewriting) This code allow to detect this policy action and disable event and exit irule. How to use this snippet: import this irule on the appliance and enable it on the VS (to disable irule event) or insert following line on top of each irule assigned to the VS (to exit the current irule): if {[POLICY::targets http-reply] } {return} As http-reply respond with HTTP/1.0 version, the TCP connection will be closed after the reply and no other request will be sent to the F5, the event can be disabled. Code : when HTTP_REQUEST priority 1 { if {[POLICY::targets http-reply] } { log local0. "LTM Policy action contains redirect. Disabling event" event disable return } } Tested this on version: 11.61.3KViews0likes4Comments