Forum Discussion

Vitor_Hugo_Domi's avatar
Icon for Nimbostratus rankNimbostratus
Jan 15, 2016

Doubt about irule - [HTTP::uri]

Hi all,


I need to help me for verification my irule if it is correct? when I receive anyway URI I need to verify the pool_YYYY the stats, if went ok, he goes to pool_XXXX. Else he changes the URI (*) and redirect to pool_ZZZZZZZ with the /test/ URI.


My doubt is if can I put URI the "*" parameter in the HTTP::uri?


when HTTP_REQUEST { [HTTP::uri] "/" { if { [active_members - list pool_YYYY] > 0 } { pool pool_XXXX } else { HTTP::uri [string map { / /test/ } [HTTP::uri]] pool pool_ZZZZZZZ } }


1 Reply

  • HI Vitor,

    corrected some portions...

    when HTTP_REQUEST { 
            if { [active_members pool_YYYY] > 0 } then { 
                pool pool_XXXX 
            } else { 
                HTTP::uri "/test[HTTP::uri]" 
                pool pool_ZZZZZZZ 

    Note1: The

    option of
    [active_members -list pool_YYYY]
    command is not required to count the numbers of active pool members. The -list option would deliver a string containing the IPs and Ports of every available pool members, which produces unnecessary overhead.

    Note2: If you want to ad a trailing string to the

    you could easily substitute the new string, based on the new trailing string and the old value (aka.

    Cheers, Kai