Forum Discussion

mlick2's avatar
mlick2
Icon for Nimbostratus rankNimbostratus
Jul 11, 2007

Redirect based on cookie

I have the following rule applied and working, but I would like to modify it so that rather than doing a redirect, I would just change the uri to a different directory. I have tried a couple of different methods with no success.

 

 

The original request is coming in to www.foo.com and the client gets /login.jsp appended from the apache server

 

 

 

when HTTP_REQUEST {

 

if { [HTTP::cookie exist "cookie"] }{

 

scan [HTTP::cookie "cookie"] "%f" cookieval

 

if { $cookieval > 5 } {

 

HTTP::redirect "http://www.foo.com/sysbusy.htm"

 

}

 

}

 

}

 

 

Thanks in advance,

 

Matt

1 Reply

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    If all you're looking to do is change the redirect to modify the URI directly before passing on the request, you'd want something like:

    
    when HTTP_REQUEST {
      if { [HTTP::cookie exist "cookie"] }{
        scan [HTTP::cookie "cookie"] "%f" cookieval
        if { $cookieval > 5 } {
          HTTP::uri "sysbusy.htm"
        }
      }
    }

    HTH,

    Colin