Forum Discussion

Hector_Salas_85's avatar
Hector_Salas_85
Icon for Nimbostratus rankNimbostratus
Mar 13, 2007

URL Rewrite and LB at HTTP request

Hello,

 

 

I am trying to find a way to perform the following:

 

 

When traffic comes to a specific Virtual Server IP, load balance and perform a URL rewrite that is different for each of the servers in the pool. For example, I have a pool of two servers. Server 1 is IP address 10.0.0.1 and the site URL for service is www1.domain.com. Server 2 is IP address 10.0.0.2 and its URL is www2.domain.com. Can you give me some suggestions on how I could accomplish this with an iRule?

2 Replies

  • The easiest way is to create two pools, one for your www1.domain.com and one for your www2.domain.com. I'm assuming from your post that you have both domains on the same virtual and with that assumption, you can create an iRule that switches on the domain and then dynamically assigns which pool to use.

    when HTTP_REQUEST {
      switch [string tolower[HTTP::host]] {
        "www1.domain.com" {
          pool www1_pool
        }
        "www2.domain.com" {
          pool www2_pool
        }
      }
    }

    where www1_pool and www2_pool are the pools containing the app servers.

    -Joe
  • Thanks Joe,

     

     

    I tried this and I think I misstated my request. The URL that the client comes to will be the same. However, when the load balancing decision is done, I need it to rewrite the URI to one specific to each web server so that what the server receives is different from the main URI that the client is coming to. Does this clear things up?