Forum Discussion
Mat78_387100
Nimbostratus
Mar 28, 2019Irule redirection based on URL
Hi,
I need to create a VIP, an redirect the traffic to different Pool depending of the URL requested.
I have created this Irule:
when HTTP_REQUEST {
if { [HTTP::host] eq "URL_1" } {
pool P...
Kai_Wilke
MVP
Mar 28, 2019Hi Mbarreau,
I'd prefer the
switch
command to parse the requested HTTP::host
value for pool
selection.
when HTTP_REQUEST {
switch -exact -- [string tolower [HTTP::host]] {
"site1.domain.de" {
pool pool_1
}
"site2.domain.de" {
pool pool_2
}
"site3.domain.de" {
pool pool_3
}
"site4.domain.de" {
pool pool_4
}
}
}
Note: The the example above uses a
command to ignore the case during evaluation. It helps to make the pool selection more robust...[string tolower [HTTP::host]]
Cheers, Kai
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