Forum Discussion

Duncan_Morgan_1's avatar
Duncan_Morgan_1
Icon for Nimbostratus rankNimbostratus
Sep 17, 2005

L7 redirect to pool based on requested folder

Hello All,

 

 

I would like to be able direct requests in a certain path to a specific pool. For example would like

 

 

http://mydomain.com/folder_name/ OR

 

https://mhydomain.com/folder_name/

 

 

to a specific pool.

 

 

In this case anything going to

 

 

http://mydomain.com is already a working virtual server.

 

 

Is this possible?

 

 

Tx,

 

DM
  • DM,

    The full url is broken out as follows:

    http://mydomain.com/folder_name

    [HTTP::host] => mydomain.com

    [HTTP::uri] => /folder_name

    So you could use the HTTP::uri with a simple string comparison to do what you want.

    For example:

    when HTTP_REQUEST {
      if { [HTTP::uri] starts_with "/folder_name" } {
        pool target_pool_name
      }
    }

    This will take any incoming request where the uri starts the string "/folder_name" and forward it to "target_pool_name". Replace that to what your pool name is and you'll be in business.

    The only thing that I don't quite understand from your post is this:

    In this case anything going to http://mydomain.com is already a working virtual server.

    Does this mean you don't have a virtual server setup for the HTTPS requests? If not, then there is no magical way in an iRule to configure a virtual to listen for 443 requests without creating one for that purpose then you could assign this iRule to that virtual.

    -Joe

  • Joe,

     

     

    thanks for you answer.

     

     

    Further clarification here...

     

     

    I have 2 virtual servers set up for the same domain - 1 is http and the other https (via client SSL)

     

     

    http://mydomain.com:80

     

    https://mydomain.com:443

     

     

    Will this iRule work for both the http and https virtual servers?

     

     

    Tx,

     

    DM
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Click here for a posting that discusses the same issue.

     

    http://devcentral.f5.com/Default.aspx?tabid=28&forumid=5&postid=4236&view=topic