Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Clear all filters
Answers

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

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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 <poolname member> <node02_ip> <port>)
        return
    }
    elseif { [HTTP::path] starts_with "/online" } {
        node node01 (or pool <poolname> member <node01_ip> <port>)
        return
    }
}
0