Forum Discussion
yves_werniers_1
Nimbostratus
Sep 08, 2009pool selection not working
Hello,
I have an irule attached to a virtual server (with no default pool).
In the rule there are some redirects and a pool selection. The pool selection (first elseif statement)...
The_Bhattman
Nimbostratus
Sep 08, 2009Looking at your logic it appears that that you have the same 2 conditions that match, but only the first will be executed while the second will be ignored For example if someone enters http://www.mydomain.be/ then they will be redirected and and sent to pool mydomain_eu_pool. You need to group them together
.
.
.
when HTTP_REQUEST {
if {[HTTP::host] == "www.mydomain.be" and [HTTP::uri] equals "/"} {
HTTP::respond 301 Location "http://www.mydomain.eu/be/zz/index.jsp"
pool mydomain_be_pool
}
elseif {[HTTP::host] == "www.mydomain.nl"} {
HTTP::respond 301 Location "http://www.mydomain.eu/nl/zz/index.jsp"
}
.
.
.
I also took the liberty of rewriting your entire iRule. This should make things look easier to read. However, since I am not exactly sure what behaviour you wanted I making a lot of assumptions
when HTTP_REQUEST {
if [HTTP::uri] eq "/" } {
switch -glob [HTTP::host] {
"www.mydomain.be" {
HTTP::redirect "http://www.mydomain.eu/be/zz/index.jsp"
pool mydomain_be_pool
}
"www.mydomain.nl" {
HTTP::redirect "http://www.mydomain.eu/nl/zz/index.jsp"
}
"www.mydomain.fr" -
"mydomain.fr" {
HTTP::redirect "http://www.mydomain.eu/fr/zz/index.jsp"
}
"www.mydomain.lu" {
HTTP::redirect "http://www.mydomain.eu/lu/zz"
}
"www.mydomain.eu" {
HTTP::redirect "http://www.mydomain.eu/zz/index.html"
}
default {
pool mydomain_eu_pool
}
}
}
}
Switch commands tend to be easier then writing multiple IF-ELSEIF statements and they tend to execute faster. I also changed from using HTTP::respond 301 to HTTP::redirects
I hope this helps
CB
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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