Forum Discussion
steve_cross_650
Nimbostratus
Nov 14, 2006NEWBIE: iRule for choosing pool based on URL
I am trying to point my subdomain towards a different pool of servers then my main site. For example:
www.mywebsite.com -> goes to pool a
beta.mywebsite.com -> goes to pool b
This is what i tried to use:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "beta.mywebsite.com"}
{
pool pool_A
}
else
{
pool pool_B
}
}
However nothing was ever routed to pool_A when i went to that URL. I even tried using a hard-coded URL so I would know when the iRule is going into effect:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "beta.mywebsite.com"}
{
HTTP::redirect "http://www.google.com"
}
else
{
pool pool_B
}
}
How can I figure out why my IF statement is failing? Would I be better using HTTP::host]] starts_with "beta."?
Again, I am a total newbie so maybe there is another setting that I don't have turned on which will make this iRule go "live". Any help would be GREATLY appreciated.
- hoolio
Cirrostratus
The rule looks fine. Just make sure that you have it associated with the VIP under the VIP's resources tab.when HTTP_REQUEST { log local0. "client: [IP::remote_addr] -> [HTTP::host][HTTP::uri]" if { [string tolower [HTTP::host]] equals "beta.mywebsite.com"}{ pool pool_A } else { pool pool_B } }
- steve_cross_650
Nimbostratus
Aaron,
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects