Forum Discussion

F51982_110427's avatar
F51982_110427
Icon for Nimbostratus rankNimbostratus
Jan 06, 2017

Irule - Load Balance

Question on redirects and load balancing the redirect based on IP Address.

Is this possible? is my first question.

Here is an Example -

Existing site is

msoft.com/login/grumpy

New Site is going to be redirected and users would go to

microsoft.com/happydays

Is it possible to issue a redirect of the existing site and load balance it to it's new servers under microsoft.com/happydays

I have attempted to issue a redirect and load balance via an if/elseif statement however the data does not appear to go beyond the Http::respond -

ltm data-group datagroupvariable {
records {
    /happydays {
       data /login/grumpy
    }
}

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

  if { ([class match $variablewebsite equals /datagroupvariable]) } {

     HTTP::respond 301 location "https://[HTTP::host][class lookup $variablewebsite /datagroupvariable]"
     } elseif { [class match [IP::client_addr] equals 192.168.1.0/24] } {
          pool NewServerPool
     } else {
          reject
     }
  }

I can get a respond page, but while including the class match of client IP, I do not get a load balanced page. I get nothing instead.

Any Ideas?

2 Replies

  • What I've done in the past on this is in order, put in the redirect, and then replace the host header with the new site. The problem that I had though, was redirect of two different site certificates since they did not share the same TLD. The irule to 302, redirect to the new VS, but then also at the end replace the host header with "new site".

     

    Does that make sense?

     

  • if { ([class match $variablewebsite equals /datagroupvariable]) } {

    I see "/datagroupvariable" as the data group name. Is the "/" a typo ?