Multi site redirect using host headers
We have a VIP setup which uses host headers. I would like an iRule to redirect the main domain to the sub domain for all the sites using the same VIP, and still send it to the sub domain pool.
Example: abc.com gets redirected to and gets sent to the pool named . mno.com gets redirected to and gets sent to the pool named xyz.com gets redirected to and gets sent to the pool named
We are trying to not have to setup 2 pools for every domain. Example:
Pool 1 Pool 2 abc.com Pool 3 Pool 4 mno.com Pool 5 Pool 6 xyz.com
We have 2 iRule assigned to that VIP.
1)The first iRule looks at the HTTP request and sends it to the pool with the same name.
when HTTP_REQUEST { pool [HTTP::host] }
2)The second iRule looks at the pool to make sure the members are up, if they are down it sends our standard App-Offline page.
when HTTP_REQUEST { set Vuri [ string tolower [HTTP::uri]] set Vheader [string tolower [HTTP::host]] set Poolname "$Vheader" set SiteName "XXXX.MAINTENANCEPAGE.org" set Irulename "Irule_$SiteName" set SiteRedirect "https://$SiteName" set Poolmember [active_members $Poolname ] set Poolmemberlist [ active_members -list $Poolname] if {$Poolmember < 1} then { log local0.alert "ALERT-TEAM Pool $Poolname is down. This mean $SiteName website is down. IRULE=$Irulename"; HTTP::respond 200 content [ifile get App_Offline] } pool $Poolname }