Forum Discussion
iRule to select pool member depending on client source ip address
Hi There,
I create an iRule for HTTP redirect based on the source IP address as below
it can be work!
when HTTP_REQUEST { if {[matchclass [IP::client_addr] equals $::datagroup1]} {pool pool1 log local0. "[IP::client_addr] is 1"} if {[matchclass [IP::client_addr] equals $::datagroup2]} {pool pool2 log local0. "[IP::client_addr] is 2"} else {pool pool3 log local0. "[IP::client_addr] is 3"} }
Now I need to apply it on HTTPS, but it seems unavailable
Can tell me how to modify for HTTPS redirect?
Thank you
3 Replies
- Mohamed_Lrhazi
Altocumulus
Are you asking how to do a reidrect in an iRule? try this page: https://clouddocs.f5.com/api/irules/HTTP__redirect.html https://clouddocs.f5.com/api/irules/HTTPToHTTPSRedirect_301.html - Jerry_Hsu_33186
Nimbostratus
Sorry, I repost my iRule
when HTTP_REQUEST { if {[matchclass [IP::client_addr] equals $::datagroup1]}
{pool pool1 log local0. "[IP::client_addr] is 1"}
if {[matchclass [IP::client_addr] equals $::datagroup2]}
{pool pool2 log local0. "[IP::client_addr] is 2"}
else {pool pool3 log local0. "[IP::client_addr] is 3"} }
I need to use iRule to assign pool from client source ip addresses
- Kevin_Stewart
Employee
If you're not offloading SSL with a client SSL profile applied to the VIP, then any HTTP commands and events will be unavailable. Fortunately though, since all of your conditions are IP-based, you could use the CLIENT_ACCEPTED event instead:
when CLIENT_ACCEPTED { if { [class match [IP::client_addr] equals datagroup1] } { pool pool1 log local0. "[IP::client_addr] is 1" } elseif { [class match [IP::client_addr] equals datagroup2] } { pool pool2 log local0. "[IP::client_addr] is 2" } else { pool pool3 log local0. "[IP::client_addr] is 3" } }
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