Forum Discussion

Mazen2006_14317's avatar
Mazen2006_14317
Icon for Nimbostratus rankNimbostratus
Mar 26, 2014

irule to redirect traffic to specific pool

Hello,

I need to redirect traffic from VS_prospect to a specific node(prospect) if the uri begin whith /NECPF/vod/cpprospect/. VS_prospect is in partition CLI05_SFR and node prospect in partition CLI03_INTE. I create in partition CLI03_INTE a pool that i named pool_prospect whith pool member the node prospect. 

My VS have as ressource a default pool named POOL_RP_ADSL to which all traffic is directed. My idea is to add an irule to VS_prospect to direct the traffic to pool_prospect if the uri begin whith /NECPF/vod/cpprospect/. Is it a correct method?

Here is the irule that i create:

when HTTP_REQUEST {
    if {  [HTTP::uri] contains "^/NECPF/vod/cpprospect/*" } {
        pool /CLI03_INTE/pool_prospect
        }
        }

is the syntax and condition correct? if yes, i will attach this irule to VS_Prospect.Do the traffic be directed to pool_prospect instead of the default pool as expected?

Advice please, it is for production environment!

6 Replies

  • Almost. Try this one:

        when HTTP_REQUEST {
        if {  [string tolower [HTTP::uri]] starts_with "/necpf/vod/cpprospect/" } {
            pool /CLI03_INTE/pool_prospect
            }
    }
    

    /Patrik

  • This irule redirect traffic to a media server. We need to activate this on demand by adding or removing the irule from VS_prospect. This procedure will be done by another team(don't having access to the LTM). Is it possible to present an API(java.net) to the team to add or remove the irule whithout giving them access to the LTM? using icontrol or....?

  • I'm afraid you need to give them at least partial admin access.

     

    As for the iControl part, I'm afraid I only know Powershell, but here's the method you'll want to use:

     

    https://devcentral.f5.com/wiki/iControl.LocalLB__VirtualServer__add_rule.ashx

     

    /Patrik