Forum Discussion

Jan-81's avatar
Jan-81
Icon for Nimbostratus rankNimbostratus
Oct 12, 2017

http redirect to another node and uri

Hi All,

 

We have recently a f5 LTM Appliance. Now I deal with iRules and have already a few simple deployed. But now I have problems to expand an iRule.

 

Here is my working iRule.

 

when HTTP_REQUEST { if { [HTTP::uri] equals "/" } { HTTP::redirect "http://[HTTP::host]/abc" } }

 

Now I want to expand the iRule, that if a Client comes with IP w.x.y.z then redirect him to a node with another IP outside the pool and another URI. Can anyone please help me?

 

Best regards Jan

 

  • Put the IP addresses that you want to send to a specific node in a datagroup (type string). Then use the following iRule to match on that condition to a specific node, otherwise redirect as normal.

    when HTTP_REQUEST { 
        if { [HTTP::uri] equals "/" } { 
            if {[class match [IP::client_addr] equals "client_ip_dg"]} {
                [HTTP::uri] /xyz
                node 192.168.1.1:80
            } else {
                HTTP::redirect "http://[HTTP::host]/abc" 
            }       
        }
    }