Forum Discussion

Nacho_de_Aguina's avatar
Nacho_de_Aguina
Icon for Nimbostratus rankNimbostratus
Oct 19, 2007

Redirect depending 2nd level

Hello

 

 

I would like to redirect http requests to a pool depending on the second level URI

 

 

Let me explain myself

 

 

http://www.mycompany.com/finances/dev

 

 

Depending on dev in this case it should be send to a pool1

 

 

I try this irule first part(which affects to the first level) works fine but the second part it doenst works

 

 

when HTTP_REQUEST {

 

set uri [string tolower [HTTP::uri]]

 

 

if { $uri starts_with "/tics"

 

or $uri starts_with "/customer"

 

or $uri contains "jdbc"

 

}

 

{

 

pool pool_www

 

} elseif { $uri starts_with "/finances/dev" } {

 

pool pool_dev

 

} else {

 

HTTP::redirect "http://www.f5.com/"

 

}

 

}

 

 

Does anybody knows what im doing wrong?

 

 

The Server replies to http://local_IP/finances/dev

 

 

Thanks in advance

 

 

Nacho de Aguinaga

1 Reply

  • Hi,

    Can you explain what request you are making, what is happening and how you want to handle the request instead?

    You can add logging to the rule to get additional detail on what is happening:

    
    when HTTP_REQUEST {
       set uri [string tolower [HTTP::uri]]
       log local0. "[IP::client_addr] - \$uri: $uri"
       if { $uri starts_with "/tics" or $uri starts_with "/customer" or $uri contains "jdbc"}{
          log local0. "[IP::client_addr] - matched test for pool_www"
          pool pool_www
       } elseif { $uri starts_with "/finances/dev" } {
          log local0. "[IP::client_addr] - matched test for pool_dev"
          pool pool_dev
       } else {
          log local0. "[IP::client_addr] - default: redirected"
          HTTP::redirect "http://www.f5.com/"
       }
    }

    Aaron