Forum Discussion

dan_6764's avatar
dan_6764
Icon for Nimbostratus rankNimbostratus
Jul 31, 2009

irule operators

Hi i wonder if someone can help me...

 

 

I have a set up where if someone access a HTTPS site and i want to redirect to HTTP on certain conditions.

 

 

Condition :

 

user is trying to access a URI that does not match a certain value

 

 

so accessing https:;/mydomain.com/secure/secure.html

 

you would get through on https

 

however if you came in to the vip on :https::/mydomain.com/notsecure/secure.html you get redirected to HTTP

 

 

here is my rule so far.. I just can't find the logic to say " does not contain "

 

 

 

when HTTP_REQUEST {

 

log local0. [HTTP::uri]

 

if { [HTTP::uri] contains "/secure/"} {

 

 

HTTP::redirect "http://[HTTP::host][HTTP::uri]"

 

}

 

}

 

 

 

 

can anyone help ??

 

thanks

 

dan

 

3 Replies

  • Hi Dan,

     

     

    You can use ! or not for a logical not. It's easiest to wrap whatever you're NOT'ing in parentheses:

     

     

    if { not ([HTTP::uri] contains "/secure/")}{

     

     

    Aaron
  • You can also check the following pages for getting started with iRules and TCL

     

     

    iRules Overview

     

    http://devcentral.f5.com/Default.aspx?tabid=75&nfpg457=2

     

     

    Tcl Reference Manual: Contents

     

    http://tmml.sourceforge.net/doc/tcl/index.html

     

     

    Aaron