Forum Discussion

Michael_Knowles's avatar
Michael_Knowles
Icon for Nimbostratus rankNimbostratus
Sep 19, 2006

iRule help -- URI Routing?

Hi all, I am new to the F5 load balancers and need some assistance setting up an iRule. We have 2 BIG-IP Kernel 4.5.14 Build5 in a load balanced environment.

 

 

(note: I orignally posted this in the wrong forum and I am attaching the reply I received. I am looking for a few different options to see what works or fits best.

 

 

I currently have a Citrix pool that load balances Web Interface on 2 servers. We also have a standard web pool that load balances port 80 traffic on 4 servers. I want to move the Citrix Web pages onto the 4 IIS boxes and have it load balanced. The issue I have is that the Citrix Web will not be the default web page and users would have to put the full path in the browser (http://vip name/citrix/metaframe). We obviously want to set this up so that users can still go to the vip name only and not know the whole path. We could do this with host headers on the IIS side but would like to use the F5 to handle this if possible.

 

 

As I understand it URI routing would look for the /citrix/metaframe and redirect the traffic to a pool, but I don’t believe that is what I need to do here? The user would have to type in the /citrix/metaframe which is what we don’t want. I can keep a separate vip and pool if necessary as long as the Citrix traffic is routed to the 4 IIS servers.

 

 

Thanks in advanced for any help.

 

 

Originally posted in the wrong Forum:

 

REPLY from Aaron

 

Posted:9/19/2006 9:33 AM Quote Reply

 

 

Hi,

 

 

To answer your question...

 

 

You could either redirect all requests made to the root document "/" to /citrix/metaframe/, or if all requested URIs should start with /citrix/metaframe/, you could redirect any request that doesn't start with /citrix/metaframe/ to /citrix/metaframe/.

 

 

Here are some examples to get you started:

 

 

Option 1:

 

 

if (http_uri equals "/") {

 

redirect to "http://%h/citrix/metaframe/"

 

}

 

else {

 

use (citrix_pool)

 

}

 

 

 

Option 2:

 

if (http_uri starts_with "/citrix/metaframe/") {

 

use (citrix_pool)

 

}

 

else {

 

redirect to "http://%h/citrix/metaframe/"

 

}

 

 

Note: I didn't check the syntax on this

 

 

Aaron

 

 

6 Replies

  • Does anyone know if a basic redirect could be done here? For example, something along the lines of if http url = http://citrixvipname redirect to http://citrixvipname/citrix/metaframe ?

     

  • If you just want to redirect all requests made to the root document to /citrix/metaframe/ then you can use option 1 above. If you want to redirect all requests that don't start with /citrix/metaframe/ to /citrix/metaframe/ you can use option 2.

     

     

    Knowing which option is better depends on the application and what else the server is used for. If every request made to the VIP should start with /citrix/metaframe/ then option 2 is a more complete solution.

     

     

    You could try testing the VIP with the two rules and see which one provides you with better functionality.

     

     

    Aaron
  • Thanks again for the help. One thing that I am confused about on option 2:

     

     

    If the rule states "http_uri starts_with /citrix/metaframe"...I read this as the user would have to be putting the URI in the browser when they make the request? We only want the user to type in http://citrixvipname without a "/" at the end and without "/citrix/metaframe".

     

     

    Based on this, it sounds like option 1 is the way I would have to go.

     

     

     

  • Some background:

     

     

    The format for a full URL is:

     

     

    protocol://hostname[:port]URI[?parameter=value]

     

     

    Port and parameter/value are optional. When someone makes a request to http://citrixvipname the browser appends a / to the end of the URL. So / is the default URI.

     

     

    So with that in mind, option 1 says that if a request is made to /, redirect it to the same host that was used in the request, but with a URI of /citrix/metaframe/. If the requested URI is not equal to /, then send the request to the pool.

     

     

    The second rule says that if the request starts with /citrix/metaframe/ send it to the pool. Else, if it doesn't start with /citrix/metaframe/ already, redirect the client to that URI using the same host that the request was made to.

     

     

    Aaron
  • Thanks for the clarification. I will test this in the lab and let you know how it goes.

     

     

    Thanks