Forum Discussion
Stephane_87808
Nimbostratus
Nov 20, 2009Assign a Pool AND rewrite an url
Hello
Is there a way :
- to assign a POOL of servers
and
- to rewrite the URL (adding a /xx.htm)
when a condition is matched in a irule ?
(of course, I will not declare any Default Pool of server for the corresponding VS)
As we need to start multiple webservers running on differents http ports (http://inter1.alk.com:8031/inter1, http://inter2.alk.com:8032/inter2, http://inter3.alk.com:8033/inter3, etc....), I would like to use only ONE VS and have the benefit from the irule capabilities to select the right pool of servers.
in addition, all the pools of servers we have defined can be the exact same servers, with the same ip addresses : the differents pools are only there to declare the differents ports we will use.
In the example below, the line "pool ..." only means what I would expect.
----------------------------------------
when HTTP_REQUEST {
if {[HTTP::host] equals "inter1.alk.com" and [HTTP::uri] equals "/" }
{
pool Pool_inter1
HTTP::redirect http://[getfield [HTTP::host] ":" 1]:8030/inter1
}
elseif {[HTTP::host] equals "inter2.alk.com" and [HTTP::uri] equals "/"}
{
pool Pool_inter1
HTTP::redirect http://[getfield [HTTP::host] ":" 1]:8031/inter2
}
}
----------------------------------------
Thanks for any help / advice
Stéphane
- hoolio
Cirrostratus
Hi Stéphane,when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: New [HTTP::method request to [HTTP::host][HTTP::uri]" Check if the URI is / if {[HTTP::uri] eq "/"} { log local0. "[IP::client_addr]:[TCP::client_port]: Matched URI check for /" Check the requested host (set to lower case) switch [string tolower [HTTP::host]] { "inter1.alk.com" { log local0. "[IP::client_addr]:[TCP::client_port]: Matched inter1." pool Pool_inter1 HTTP::uri "/inter1" } "inter2.alk.com" { log local0. "[IP::client_addr]:[TCP::client_port]: Matched inter2." pool Pool_inter2 HTTP::uri "/inter2" } default { log local0. "[IP::client_addr]:[TCP::client_port]: No match on Host header value" } } } }
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