Forum Discussion

bigiptechie_982's avatar
bigiptechie_982
Icon for Nimbostratus rankNimbostratus
Nov 04, 2014

Irule to modify server response

Hello All,

 

I have the below requirements, One virtual server (10.10.10.10:443) One pool with 20 pool members (172.16.1.X:80) Users will be accessing five different urls e.g

 

https://sales.example.com

 

https://mgmt.example.com

 

https://learn.example.com

 

https://train.example.com

 

https://hr.example.com

 

When the request comes from users to vs it should come as above but the vs should change it to the following accordingly and send it to the pool members

 

https://sales.example.com ------ VS----- http://int-sales.local.loc (pool members)

 

https://mgmt.example.com -----VS ---- http://int-mgmt.local.loc (pool members)

 

https://learn.example.com --- VS ---- http://int-learn.local.loc (pool members)

 

https://train.example.com --- VS ----- http://int-train.local.loc (pool members)

 

https://hr.example.com ----- VS ---- http://int-hr.local.loc (pool members)

 

When the vs response to the users it should retain the original urls as below

 

Users – https://sales.example.com ---- VS ------ http://int-sales.local.loc (pool members) VS ---- https://sales .example.com ------ client

 

I have tried to use the irule below,

 

when HTTP_REQUEST { if {[HTTP::host] equals "sales.example.com" } { set host [string map { sales.example.com int-sales.local.loc} [HTTP::host]] HTTP::redirect "https://$host[HTTP::uri]" } }

 

But the new url is now showing in the user browser as https://int-sales.local.loc Could you please help with the required irule to modify the server response; and if I can merge all in one irule?

 

1 Reply