Forum Discussion

Vikneswaran_709's avatar
Vikneswaran_709
Icon for Nimbostratus rankNimbostratus
Dec 14, 2017

Irule for Redirection

Please help me with the irule to redirect the traffic based on specific URI to a pool-1 else (All other traffic)redirect to Pool-2. Along with iRule should log the information(Source and destination) in Logs

 

5 Replies

  • iRule for pool redirection is mentioned below: when HTTP_REQUEST { if { [HTTP::uri] starts_with "/abc" } { pool pool1 } elseif { pool pool2 } }

     

  • You can log client IP using below irule

     

    when CLIENT_ACCEPTED { log local0. "[virtual] - client ip=[IP::client_addr]" }

     

  • This is for server end connection:

     

    when SERVER_CONNECTED {

     

    log local0. "Source IP address for connection to node: [getfield [IP::local_addr] "%" 1]"

     

    }

     

  • LOG SOURCE AND DEST. IP

     

    when HTTP_RESPONSE { log local0. "The Client IP address is [clientside {IP::remote_addr}] is connected with Server IP is [serverside {IP::remote_addr}]" }

     

    OR, (BOTH ARE DIFFERENT BASED ON EVENT AND APPLICATION)

     

    when SERVER_CONNECTED { log local0. "The Client IP address is [clientside {IP::remote_addr}] is connected with Server IP is [serverside {IP::remote_addr}]" }