Forum Discussion
HTTPS iRule to map requests to different pools
I have a virtual which I want to direct default traffic to PoolA, but any requests for a specfic directory to another pool. I can do this currently with the following iRule on a virtual for HTTP and it seems to work fine if I set a default pool then add this iRule to the virtual:
when HTTP_REQUEST {
switch -glob [HTTP::host][HTTP::uri] {
"*.somedomain.com/dir1/*" { pool dir1-pool }
}
}
I want to do the same thing for HTTPS requests and I have set up a second virtual with the same default pool and added an SSL client profile to terminate SSL at the LTM, but I'm not sure its working correctly.
has anyone done something similar?
thanks!
John
1 Reply
- Gbps_31870
Nimbostratus
Hi JHally,
Yes it should work for both HTTP and HTTPS in the case you mentioned, try the below iRule in both HTTP and HTTPS
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] contains "somedomain.com"} {
switch -glob [string tolower [HTTP::uri]] {
"/dir1/*" { pool dir1-pool }
default { pool default-pool }
}
}
}
Aaron (hoolio) has highlighted very important point if you have an iRule selecting a pool, to enable OneConnect profile to the VS to ensure each HTTP/HTTPS request is load balanced to the correct pool.
the post: https://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/2163946/showtab/groupforums/Default.aspx
the link: https://devcentral.f5.com/wiki/AdvDesignConfig.ONECONNECT.ashx
HTH
BR,
Abdul
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
