Forum Discussion

Michael_Rose_11's avatar
Michael_Rose_11
Icon for Nimbostratus rankNimbostratus
Oct 31, 2008

Can an iRule loop through values from a file or website?

Greetings all,

 

 

Long time reader/user, first time poster.

 

We are using a wildcard DNS entry to send all *.company.com requests to a specific pool. However, we have another pool setup to handle our larger customers, which use a different hostname. We have been using DNS entries to redirect them to this second pool, but the number of “large” customers is getting quiet large and we would like to make this redirection done on the LB by having it lookup if the hostname exists in a file and redirecting to the specific pool based on if the hostname exists or not.

 

 

For example:

 

*.companyname.com goes to “pool allrequests”.

 

 

If the request is received to siteA.companyname.com, redirect to “pool bigcustomers” other wise redirect to "pool allrequests".

 

 

We have over 30 hostnames that need to be redirected to a different pool from the wildcard pool.

 

 

Can a iRule be written to see if the hostname exists in a file (or website) and redirect based on whether the hostname exists in the file/website or not?

 

 

Thanks in advance,

 

1 Reply

  • Sure just create a data group with the hostnames that need to go to the other pool, let's say call it "bigcustomers".

    Then use the matchclass command to look for the HTTP host in the request:

     
     when HTTP_REQUEST { 
      if { [matchclass [HTTP::host] equals $::bigcustomers] } { 
         pool bigcustomers 
        } else { 
         pool allrequests 
        } 
     } 
     

    You can use an external data group (also called a class file) if the hostnames need to be updated dynamically, then you can just upload a new class file when that happens. Otherwise a plain data group will work fine.

    Denny