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

Filter by:
  • Solution
  • Technology
Answers

Redirect to different Pool based on URL

Redirect to different Pool based on URL I have 1 VIP and want to re-direct to different pool depending on the url.

abppv1-ui-qa2.apple.com:8443 should go to Pool1 abpp-notif-qa.am.tsacorp.com:8443 should go to Pool2

I tried below iRule but it did not work. Any help would be highly appreciated.

when HTTP_REQUEST {

if { [HTTP::path] contains "abppv1-ui-qa2" } { pool Pool1 } elseif { [HTTP::path] contains "abpp-notif-qa" } { pool Pool2 }

}

0
Rate this Question
Comments on this Question
Comment made 3 months ago by Atee 1

Just to add both front and backend ports are 8443.

0
Comment made 3 months ago by StuKirby 80

Hello

I have this working this way:

when HTTP_REQUEST { if { [HTTP::host] eq "app1.domain.co.uk" } { pool app1_pool
} elseif { [HTTP::host] eq "app2.domain.co.uk" } { pool app2_pool
} }

0
Comment made 3 months ago by Atee 1

Thanks StuKirby!!! It worked perfectly as I expected! Appreciate your help!

0

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

There are many iRule available in devcentral. But I will suggest you to use f5 policy to match URI n redirect traffic to pool... Create a new policy with properties:

Policy requires http Policy controls forwarding For each policy rule, define:

condition : http-uri parh starts_with /bugid action : forward pool pool_x Create a default rule without conditon assigning the default pool..

Example iRule

when HTTP_REQUEST {
set uri [string tolower [HTTP::path]]
switch -glob $uri {

     "/book/" {
 pool pool_X
    }
     "/manage/" {
 pool pool_Y
     }
    "/checkin/" {
 pool pool_Z
        }
     }
   }
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

use [HTTP::host]

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hi,

I advise you to use Policies without Irule (Local Traffic ›› Policies : Policy List). It's more simple to maintain and manage for this kind of needs:

Create a policy then in your rule set the following condition:

Match all of the following conditions: HTTP Host is : app1.domain.co.uk

Do the following when the traffic is matched: Forward traffic to pool ...

And you can add as many rules as you like...

Then you have to attached this policy to your VS...

Let me now if you need details.

0