cancel
Showing results for 
Search instead for 
Did you mean: 

Irule optimization

shinchan-f5
Cirrus
Cirrus

Trying to redirect connection if response status code is 404 and the requested http uri contains list of uri's provided in the datagroup.

It worked well as far as the requirement was concerned. But it is utilizing much of the memory owing to which have to take the irule off.

Below is the irule. Need help to optimize it so as to decrease the CPU resource.

 

when CLIENT_ACCEPTED {

set req 0

}

 

when HTTP_REQUEST {

 set http_request [HTTP::request]

 if {$req eq 1 && [class match [HTTP::uri] contains "url"]}{

   HTTP::redirect "http://191.168.10.20/xyz/"

   set req 0

}}

 

when HTTP_RESPONSE timing off {

 if { [HTTP::status] == 404}{

set req 1

HTTP::retry $http_request

}}

2 REPLIES 2

shinchan-f5
Cirrus
Cirrus

when HTTP_REQUEST {

 set http_uri [HTTP::uri]

}

when HTTP_RESPONSE {

 if { [HTTP::status] == 404 && [class match $http_uri contains "url"] }{

HTTP::redirect "http://191.168.10.20/xyz/"

}}

Samir
Nacreous
Nacreous

Prepared the iRule based on the hints provided in question. You can validate and let us know the result.

when HTTP_REQUEST { set url_http [HTTP::uri] } when HTTP_RESPONSE { if { ([HTTP::status] == 404) && ( $url_http contains "url") } { HTTP::respond 302 Location "http://191.168.10.20/xyz/" } }

Hope it will work.