Forum Discussion

Ravi_Rajan_7549's avatar
Ravi_Rajan_7549
Icon for Nimbostratus rankNimbostratus
Oct 14, 2008

Need help on irules

Hi,

 

 

Currently i have a setup as below -

 

 

VS IP - 10.2.3.2 (test.xyz.com)

 

Pool Member 1 - 192.168.10.2 (server1.xyz.com)

 

Pool Member 2 - 192.168.10.3 (server2.xyz.com)

 

 

Now the application hosted on servers 1 and 2 work only if the host header is server1.xyz.com or server2.xyz.com respectively.

 

 

I need some help on irule which rewrites the host header before sending the request to the backend servers. Also while rewriting, i need to take care of which pool member has been selected.

 

 

Request your inputs.

 

 

Thanks,

 

Ravi

1 Reply

  • Hi Ravi,

     

     

    You can get the selected pool member in (or after) the LB_SELECTED event using LB::server. You can modify the HTTP headers just before the request is sent to the pool in HTTP_REQUEST_SEND using 'clientside {HTTP::header replace Host "newhost.example.com"}.

     

     

    It would probably make sense to create a string datagroup with the IP addresses and hostnames. You could then use findclass to get the hostname for the selected server.

     

     

    There is a related example in this post (Click here).

     

     

    Reply here if you get stuck.

     

     

    Aaron