Forum Discussion

bruno_thomas_12's avatar
bruno_thomas_12
Icon for Nimbostratus rankNimbostratus
Jul 25, 2005

Basic HTTP redirect question on LB pool

 

when HTTP_REQUEST

 

 

if HTTP:URL contains '/acces'

 

 

pool bea_pool

 

 

It seems like all subsequent requests are redirected to home page of the web servers, Http host/acces. Is there a way to keep the contextual URI for the subsequent pages

 

 

would this work:

 

 

pool bea_pool$uri ????????

 

 

thx
  • this is the actual code :

     

     

    when HTTP_REQUEST {

     

    set uri [HTTP::uri]

     

     

    if { $uri contains "acces" } {

     

     

    pool bea_pool$uri

     

     

    } elseif { $uri contains "aide" } {

     

     

    HTTP::redirect "http://10.172.155.201/$uri"

     

    }

     

     

    }
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Well, there is nothing that would otherwise prevent that from working. However, I'm not entirely sure that it accomplishes what you want. I think you may be better off using a Cookie to save the context across requests. For example:

    
    when CLIENT_ACCEPTED {
       set add_cookie ""
    }
    when HTTP_REQUEST {
       if { [HTTP::cookie exists "MyCookie"] } {
           MyCookie contains the original pool used
          pool bea_pool
       } else {
           This must be the first access
          if { [HTTP::uri] contains "acces" } {
             pool bea_pool
             set add_cookie bea_pool
          } elseif { [HTTP::uri] contains "aide" } {
             HTTP::redirect "http://10.172.155.201/[HTTP::uri]"
          } else {
              What should happen here?
              Is there a default pool on the VS that
              will be used if none is specified here?
          }
       }
    }
    when HTTP_RESPONSE {
       if { $add_cookie ne "" } {
          HTTP::cookie insert name "MyCookie" value $add_cookie
          set add_cookie ""
       }
    }

  • 01070151:3: Rule [persistence] error:

     

    line 13: [deprecated usage, use else or elseif] [ ]

     

    line 13: [missing an expression] [ ]

     

    line 10: [undefined procedure: [HTTP::uri] contains "aide" ] [if { [HTTP::uri] contains "acces" } {

     

    pool bea_pool

     

    set add_cookie bea_pool

     

    } else if { [HTTP::uri] contains "aide" } {

     

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

     

    } else {

     

    What should happen here?

     

     

     

    this what i get.. i did not dig yet but maybe you can help me.
  • once i associate rule (persistence) to virtual server i get this:

     

     

     

    01070394:3: HTTP_REQUEST event in rule (persistence) requires an associated HTTP or FASTHTTP profile on the virtual server (Redir_https).
  • i associated with default http profile..big ip is taking the config but it s still not working ....at some point traffic seems to fall on other node and auth page is represented..
  • we where succesfull applying persistence without using irule?? question what s the difference between using weblogiccookie or just plain cookie?
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    That's a really good question! -> Perhaps to save one less cookie???

     

     

    I'll have to think about this, as I don't have a good answer right now...