Forum Discussion

Tom_White_69772's avatar
Tom_White_69772
Icon for Nimbostratus rankNimbostratus
Jan 27, 2009

URL/URI redirect

We have a request for a redirect on a VIP wherein the client comes into the VIP on port 9080 and wants to be directed between two pools based on the RUL/URI. I'm using an http request, but it is not working presumably because the request is coming in on port 9080 and not http, even tho' the clients are using their browser to access the app. Here is our current iRule, that is not working:

 

 

when HTTP_REQUEST {

 

switch -glob [HTTP::host][HTTP::uri] {

 

"*/ENTBPM/*" {

 

pool $entbpm_pool

 

}

 

"*/CONTENTONLY/*" {

 

pool $contentonly_pool

 

 

 

How can we modify this so it works using only port 9080?

2 Replies

  • What happens if you remove the iRule, associate the first pool to the VIP as the default pool, and test? Do requests for the URI's matching */ENTBPM/* succeed? What about if change the pool to the other and test a URI matching */CONTENTONLY/*? If that's not working you need to check the routing and VIP configuration. Once you get the VIP working with the individual pools, you can retest with the iRule for pool selection.

    If you do see problems when testing the iRule, can you add some debug logging? You're referencing variables for the pool names, but I don't see that you've set the variables with pool names. Also, you probably just need to check the path for the request (not the host and URI) for the /ENTBPM/ and /CONTENTONLY/ strings. Here is an example with logging.

     
     when HTTP_REQUEST { 
      
        set entbpm_pool "my_pool_name_1" 
        set contentonly_pool "my_pool_name_2" 
        set default_pool "my_pool_name_3" 
      
        log local0. "[IP::client_addr]:[TCP::client_port]: New request to [IP::local_addr]:[TCP::local_port], [HTTP::host][HTTP::uri]" 
      
         Check the requested path 
        switch -glob [HTTP::path] { 
           "*/ENTBPM/*" { 
              log local0. "[IP::client_addr]:[TCP::client_port]: Matched $entbpm_pool pool" 
      pool $entbpm_pool 
           } 
           "*/CONTENTONLY/*" { 
              log local0. "[IP::client_addr]:[TCP::client_port]: Matched $contentonly_pool pool" 
              pool $contentonly_pool 
           } 
           default { 
              log local0. "[IP::client_addr]:[TCP::client_port]: Matched default pool" 
              pool $default_pool 
           } 
        } 
     } 
     

    Aaron