# load balancing 4 servers

**URL:** <https://community.f5.com/t/load-balancing-4-servers/5320>\
**Category:** Technical Forums\
**Tags:** application-delivery, ltm\
**Created:** [August 21, 2016, 10:14pm UTC](https://community.f5.com/t/load-balancing-4-servers/5320 "2016-08-21T22:14:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mouene\_240365](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@Mouene\_240365](https://community.f5.com/u/Mouene_240365)\
**Post date:** [August 21, 2016, 10:14pm UTC](https://community.f5.com/t/load-balancing-4-servers/5320/1 "2016-08-21T22:14:37Z")

</div>

I have 4 web application servers and I am successfully load balancing between them , except I want F5 to load balance only between two of these servers once the URI become(for example): [http://192.168.1.80/Arch/Enj](http://192.168.1.80/Arch/Enj)

---

<div class="post-metadata">

**Author:** ![Kevin\_Stewart](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/kevin_stewart/32/15267_2.png) [@Kevin\_Stewart](https://community.f5.com/u/Kevin_Stewart)\
**Post date:** [August 21, 2016, 10:52pm UTC](https://community.f5.com/t/load-balancing-4-servers/5320/2 "2016-08-21T22:52:12Z")

</div>

Pretty straight forward. Create two pools: one with all four and the other with the two specific ones. Assign the pool of 4 to the virtual server and employ an iRule something like this:

```tcl
when HTTP_REQUEST {
    if { [string to lower [HTTP::uri]] starts_with "/arch/enj" } {
        pool special_pool
    }
}

```

You could also use a switch:

```tcl
when HTTP_REQUEST {
    switch -glob [string to lower [HTTP::uri]] {
        "/arch/foo*" -
        "/arch/bar*" -
        "/arch/enj*" {
            pool special_pool
        }
    }
}

```

And depending on BIG-IP version you could also skip iRules and do all of this in CPM (LTM policies).
