Forum Discussion
iRule redirect to pool based on path
Hi,
I am migrating rules from ISA Server to F5, actually the ISA check the path and redirect to backend server for example,
domain.com/online -> domain.com/online/ on node01 (10.0.0.1) domain.com/-> domain.com/online/index.html on node01 (10.0.0.1) domain.com/auth -> domain.com/auth on node02 (10.0.0.2)
i created an iRule to check the path and redirect to asigned pool when HTTP_REQUEST { if { [HTTP::path] starts_with "/" } { http:redirect "/online/" pool pool_node01 return } if { [HTTP::path] starts_with "/online" } { pool pool_node01 return } if { [HTTP::path] equals "/online/auth" } { pool pool_node02 return } }
But, ihave some problems when i try to redirect to backend servers.
Any suggestions?
Regards
1 Reply
- Brad_Parker
Cirrus
Part of your problem is order of operations and a couple syntax. Try something like this. It reorders the second two if statements to get your expected results.
HTTP_REQUEST { if { [HTTP::path] equals "/" } { HTTP::redirect "/online/" return } elseif { [HTTP::path] starts_with "/online/auth" } { node node02 (or pool ) return } elseif { [HTTP::path] starts_with "/online" } { node node01 (or pool member ) return } }
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