append irule based on source address help

I am in need of an irule to append a uri if your source address is not x.x.x.x The /auth-smartweb redirects you to our adfs for single signon. once authenticated your are brought back to the site. The below irule works in a sense as it appends the /auth-smartweb but once you authenticate you get in a loop and the site never loads.

when HTTP_REQUEST { if { not ( [IP::addr [IP::client_addr] equals a.b.c.c/16] ) } { HTTP::uri /auth-smartweb } }

if I use a simple append without looking at the source address everything works fine and you don’t get in this loop.

when HTTP_REQUEST { if {([HTTP::uri] == “/”) } { HTTP::uri /auth-smartweb } }

Am I doing anything wrong? is there a better way to do this?

Seems to me that you need to test for both the IP address being in the specified range as well as the URI being equal to “/”.

Hi,

Try this code

when HTTP_REQUEST { 
    if { not ( [IP::addr [IP::client_addr]/16 equals a.b.0.0] ) } { 
        HTTP::uri /auth-smartweb 
    } 
}