Forum Discussion
Send traffic from one VS to different pools depending on URI
Hello,
We have got: - 2 possible URI's, - 1 Virtual Server - 2 Pools
We'd like to forward traffic to Pool_CRM81_ccfr if uri contains or starts with "/ecommunications_ccfra" & send to Pool_CRM81_Content_80 if uri contains or starts with "/content" is the bellow iRule correct for our case?
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
if { $uri starts_with "/ecommunications_ccfra" } {
pool Pool_CRM81_ccfra
} elseif { $uri starts_with "/content" } {
pool Pool_CRM81_Content_80
} else {
drop
}
}
Also we'd like to enable persistance with cookie only for the 1st pool(ccfra) & not the second one
many thanks. regards,
- Ilian_Ivanov
Nimbostratus
Yes, the iRule looks correct. About the persistence, you can set cookie persistence on your VIP and use that iRule to disable the persistence for Pool_CRM81_Content_80:
when HTTP_REQUEST { set uri [string tolower [HTTP::uri]] if { $uri starts_with "/ecommunications_ccfra" } { pool Pool_CRM81_ccfra } if { $uri starts_with "/content" } { pool Pool_CRM81_Content_80 persist none } else { drop } }
- Stanislas_Piro2
Cumulonimbus
Hi,
You can also use a switch instead of if / then / else
when HTTP_REQUEST { switch -glob -- [string tolower [HTTP::uri]] { "/ecommunications_ccfra*" { pool Pool_CRM81_ccfra } "/content*" { pool Pool_CRM81_Content_80 persist none } default {drop} } }
- Earvin_247775
Altocumulus
Hi,
also have this requirement before. You may try to use the Local Traffic Policies which is available on 11.5.3 and later.
This works very similar to iRules on simple load balancing of http traffic and good thing is that it is done on GUI instead of tcl.
Thanks, EJ
- Yazid_Abdesslam
Nimbostratus
Thank You EJ
I'm a bit newbie at Traffic Policies,
can you help me applying this with the actual case?
regards,
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