Forum Discussion
irules for different pool
Hi please look this irules:
when HTTP_REQUEST { if { [HTTP::uri] contains "login" } { pool pc } elseif { [HTTP::uri] contains "hfs" } { pool pc2 } else { pool dns } } now I take a test---I input browser with "txhd.com/login",I have the anwser from pc pool , but if I input browser with "login.txhd.com" ,I gain the anwser from dns pool; How can gain user defined page according to my irulse when I input browser "login.txhd.com" or "hfs.txhd.com"? Please help me change the irules
2 Replies
- Kevin_Stewart
Employee
You first have to understand all of the parts of a URL. So for example:
http://www.domain.com/images/mycat.png?foo=bartestwww.domain.com is the host, so that's accessible with the [HTTP::host] or [HTTP::header Host] command
/images/mycat.png?foo=bar is the "URI", so that's accessible via the [HTTP::uri] command
/images/mycat.png is the path, so that's accessible via the [HTTP::path] command
?foo=bar is the query, so that's accessible via [HTTP::query]
So to answer your question, "login.txhd.com" isn't matching your [HTTP::uri] match because "login" isn't in the URI, it's in the Host.
- Stanislas_Piro2
Cumulonimbus
Hi,
- HTTP::uri only return URI part of the URL--> starting with the /
- HTTP::host will return the Host part of the URL: login.txhd.com
I recommend you to use switch instead of if / elseif / else
when HTTP_REQUEST { switch -glob [HTTP::host] { "login*" {pool pc} "hfs.txhd.com" {pool pc2} default {pool dns} } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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