We want to load balance requests based on the hostname header inside the HTTP requests. In this example, there is a separate group of real servers for each hostname header and requests for unknown host headers should get a reset back from the ServerIron/ADX.
To achieve this we are going to parse the traffic using a csw policy – there are two domains (www.domaina.de and www.domainb.de) and there is a dedicated web server for each domain. Requests for any other domain will get a TCP RST packet back.
We will use Layer-7 switching using csw to achieve this. Please remember the following things:
Each request which does not match any of the configured rules is going to hit the default rule - the default rule is configure to send a RESET to the client.
The example is based on groups with a single server in each group – it is possible to have multiple servers in each group. The ServerIron is going to load balance in between the real servers in the selected group in case there are multiple servers in the group.
The virtual server receiving the request is the one with IP address 192.168.9.200. Requests with host header www.domainA.de need to go to real server rs101 (192.168.9.101), requests with host header www.domainB.de to real server rs102 (192.168.9.102) and all other request will get a RESET back.
csw-rule "domA" header "host" equals "WWW.DOMAINA.DE" case-insensitive csw-rule "domB" header "host" equals "WWW.DOMAINB.DE" case-insensitive ! csw-policy "MP" case-insensitive match "domA" forward 1 match "domB" forward 2 default reset-client ! server real rs101 192.168.9.101 port http port http url "HEAD /" port http group-id 1 1 ! server real rs102 192.168.9.102 port http port http url "HEAD /" port http group-id 2 2 ! server virtual vs200 192.168.9.200 port http port http csw-policy "MP" port http csw bind http rs101 http rs102 http
Use some clients to send requests with a known host header in – check the statistics related to the defined csw rule. Each rule does have a counter to show the amount of hits related to this rule.
ServerIron# show csw-policy MP
Policy Name :MP
Policy Type :Content Switching Policy index : 1 Reference Count : 1 total received packe: 0 created session : 0 total scanned packet : 0 no session drop : 0 no session frag drop : 0 send mirror ip packe: 0 send mirror packet : 0 send redirect packet: 0 case-insensitive : TRUE