Forum Discussion

Vish04_293402's avatar
Vish04_293402
Icon for Nimbostratus rankNimbostratus
Aug 31, 2018

redirecting traffic to individual members based on condition

Http Request for Mobile will have header as “DEBUG_INDICATOR” with value “true” then request must go to In-Active member else go to Active member.

 

Pool 1: Primary Pool 1.1.1.1 ( Datacenter 1 is Active) 1.1.1.2 ( Datacenter 2 is In-Active)

 

Pool 2: Secondary Pool 1.1.1.1 ( Datacenter 1 is Active) 1.1.1.1 ( Datacenter 2 is In-Active)

 

  • I thought of something like this;

     

    when HTTP_REQUEST { if { [HTTP::header exists DEBUG_INDICATOR] and [HTTP::header DEBUG_INDICATOR] equals "true" } { node 1.1.1.1 set url [HTTP::header Host][HTTP::uri] set vip [IP::local_addr]:[TCP::local_port] foreach aHeader [HTTP::header names] { log local0. "HTTP REQUEST HEADER $aHeader: [HTTP::header value $aHeader]" } } }

     

    Not sure if this is the correct method for creating this IRule

     

  • I'm not sure what the 'set url' and 'set vip' statements are doing here, but everything else seems reasonable.

    when HTTP_REQUEST {
        if { ( [HTTP::header exists DEBUG_INDICATOR] ) and ( [HTTP::header DEBUG_INDICATOR] equals "true" ) } {
            pool1
        } else {
            pool2
        }
    }