F5 is upgrading its customer support chat feature on My.F5.com. Chat support will be unavailable from 6am-10am PST on 1/20/26. Refer to K000159584 for details.

Forum Discussion

Parveez_70209's avatar
Parveez_70209
Icon for Nimbostratus rankNimbostratus
Dec 12, 2013

How to Switch Between Pools using Irule

Original Irule:

 

==============================

 

when HTTP_REQUEST { set http_uri [string tolower [HTTP::uri]]

 

if {$http_uri equals "/" } { HTTP::redirect "https://kepogstest.jdadelivers.com/ikb" pool kepogstest.example.com-POOL return }

 

}

 

========================

 

Now one option of the application called floorplan is served by another server, so based on that we created a second pool named as : kepogstest.example.com-Floorplan-POOL.

 

Kindly assist in editing the Irule which will include the new created pool.

 

Thanks and Regards Parveez

 

3 Replies

  • I don't get why you send an HTTP::redirect to the client, but also send to the pool at the same time ? Usually, when you send to a pool member, you don't send and HTTP redirect at the same time. But i am probably missing something here. Anyhow, what you are looking for should be like this (replace /floorplan by what is required in term of URI for your application, same for your redirect):

    when HTTP_REQUEST { set http_uri [string tolower [HTTP::uri]]
            if {$http_uri equals "/" } {
                 HTTP::redirect "https://kepogstest.jdadelivers.com/ikb" 
                 pool kepogstest.example.com-POOL
                 return 
                 }
            elseif {$http_uri equals "/Floorplan" } {
                 HTTP::redirect "https://kepogstest.jdadelivers.com/Floorplan" 
                 pool kepogstest.example.com-Floorplan-POOL
                 return 
    

    } }

  • Philou, I think your second condition may cause an infinite loop. If URI equals /floorplan, go to /floorplan. This issue, Parveez, is a matter of state. As Philou alludes, when a client makes a request (ingress) and the iRule responds with a redirect (egress), there is no further ingress and no traffic will get sent to a pool. Something like this may work instead:

    when HTTP_REQUEST {    
        set http_uri [string tolower [HTTP::uri]        
        if { $http_uri equals "/" } { 
            HTTP::redirect "https://kepogstest.jdadelivers.com/ikb"             
        } elseif { $http_uri starts_with "/ikb" } {
            pool kepogstest.example.com-POOL            
        }        
    }