Forum Discussion

Valentine_96813's avatar
Valentine_96813
Icon for Nimbostratus rankNimbostratus
Dec 14, 2012

Redirect on client IP and uri

I have a request to redirect a session if certain IP comes in and then only if it has a keyword in the URI and then setting persistence. SO basically combining:

 

 

when CLIENT_ACCEPTED {

 

if { [IP::addr [IP::client_addr]/8 equals 10.0.0.0] }

 

with

 

when HTTP_REQUEST {

 

if { [HTTP::path] starts_with "/tulip/" }{

 

persist cookie

 

}

 

else {

 

persist source_addr

 

}

 

}

 

 

Can this be combined with && in the middle? I am trying to run this through the editor and its not working. Could use a little help.

 

4 Replies

  • You can only combine them in the HTTP event;

    
    when HTTP_REQUEST {
     if { (([HTTP::path] starts_with "/tulip/") && ([IP::addr [IP::client_addr] equals 10.0.0.0/8])) } {
      persist cookie
      }
     else {
      persist source_addr
      }
    }
    
  • Note the '&&' should just be '&&', the forum software just mangles them for some reason.
  • Thanks for this. I will setup to rey this soon. Coudn't see the forest through the trees this morning.