# Redirect to pool based on incoming HTTPS URI

**URL:** <https://community.f5.com/t/redirect-to-pool-based-on-incoming-https-uri/1994>\
**Category:** Technical Forums\
**Tags:** dev, irules, devops, application-delivery\
**Created:** [March 11, 2011, 8:19pm UTC](https://community.f5.com/t/redirect-to-pool-based-on-incoming-https-uri/1994 "2011-03-11T20:19:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aaron\_107144](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Aaron\_107144](https://community.f5.com/u/Aaron_107144)\
**Post date:** [March 11, 2011, 8:19pm UTC](https://community.f5.com/t/redirect-to-pool-based-on-incoming-https-uri/1994/1 "2011-03-11T20:19:12Z")

</div>

I’ve been digging and testing all day, but I’m coming up blank.

We’ve had great success so far with the LTMs marshaling traffic from the internet to the Exchange TMG servers for Outlook Anywhere, OWA, and the like (Exchange 2010)

So yesterday, I got a request from our Exchange admin to redirect HTTPS traffic for Outlook Anywhere and autodiscover to a new set of IP’s - While leaving the rest of the traffic to pass as usual to the OWA virtual server/pool. So basically I’m trying redirect incoming Exchange 2010 traffic to a different pool based on the URI.

As much as I’d like to just use an HTTP redirect (easy) - The TMG servers’ security requires that the requested URLs remain intact. So I can’t substitute the VIP of the new VS in the URL.

The rule I’ve come up with is this:

when HTTP\_REQUEST

{

if {([HTTP::uri] starts\_with {/rpc}), or ([HTTP::uri] starts\_with {/oab}), or ([HTTP::uri] starts\_with {/ews}), or ([HTTP::uri] starts\_with {/autodiscover})}

{ pool TMG\_OA\_Pool }

else { pool TMG\_OWA\_Pool }

}

When I try to apply this iRule to my incoming HTTPS Virtual Server, I get an error:

HTTP\_REQUEST event in rule (Exch\_OA\_Redirect) requires an associated HTTP or FASTHTTP profile on the virtual server Exch\_TMG\_Edge\_VIP

When I add an HTTP profile to the VS (It’s currently “none” because it’s an HTTPS VS) OWA breaks. I added the iRule anyway, and I can see the rule getting hit, but nothing makes it to the OA pool counters.

Any ideas? Am I going about this wrong?

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [March 11, 2011, 9:47pm UTC](https://community.f5.com/t/redirect-to-pool-based-on-incoming-https-uri/1994/2 "2011-03-11T21:47:44Z")

</div>

Hi Aaron,

With most Exchange deployments on LTM I’ve heard about, it’s a requirement to decrypt the SSL on LTM to do URI inspection. If you haven’t done this already, but want to do URI inspection, I think you’ll need to import the server cert onto LTM and add a client SSL profile to the virtual server.

Once you do, you can use an HTTP based iRule like this:

```tcl
when HTTP_REQUEST {

   switch -glob [string tolower [HTTP::path]] {
      "/rpc*" -
      "/oab*" -
      "/ews*" -
      "/autodiscover*" {
         pool TMG_OA_Pool
      }
      default {
         pool TMG_OWA_Pool
      }
   }
}

```

Aaron

---

<div class="post-metadata">

**Author:** ![Chris\_Miller](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/chris_miller/32/14702_2.png) [@Chris\_Miller](https://community.f5.com/u/Chris_Miller)\
**Post date:** [March 12, 2011, 7:36pm UTC](https://community.f5.com/t/redirect-to-pool-based-on-incoming-https-uri/1994/3 "2011-03-12T19:36:37Z")

</div>

Aaron - I’ve often encountered applications that won’t function with an attached HTTP profile. I’ve just assumed it’s because an HTTP profile causes the Virtual Server to require an HTTP request before opening a TCP connection to the pool member. While the HTTP profile is a requirement for L7 visibility, doesn’t it also force the application to comply with certain standards? If it’s SSL traffic not being decrypted on LTM, would these requests essentially look incorrect and therefore be kept from pool members?

---

<div class="post-metadata">

**Author:** ![Austin\_Geraci](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/austin_geraci/32/28655_2.png) [@Austin\_Geraci](https://community.f5.com/u/Austin_Geraci)\
**Post date:** [March 13, 2011, 4:48pm UTC](https://community.f5.com/t/redirect-to-pool-based-on-incoming-https-uri/1994/4 "2011-03-13T16:48:54Z")

</div>

Absolutely… You’ll need to terminate ssl on your LTM(s)… Are you?

---

<div class="post-metadata">

**Author:** ![Aaron\_107144](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Aaron\_107144](https://community.f5.com/u/Aaron_107144)\
**Post date:** [March 14, 2011, 1:17pm UTC](https://community.f5.com/t/redirect-to-pool-based-on-incoming-https-uri/1994/5 "2011-03-14T13:17:58Z")

</div>

Yes, I am terminating SSL on the LTM - It’s actually built to F5’s Exchange 2010 design guide specs. There are 2 VS - 1 HTTP and 1 HTTPS, both with the same VIP. The HTTP VS has a HTTPS redirect iRule, sending traffic sourced on port 80 to the HTTPS VS.

The issue is that if the client request is HTTPS to begin with, the HTTP VS is never hit. The session is established to the HTTPS VS directly - This is why I’m assuming whichever iRule I use to redirect the traffic to the other pool is going to have to be applied to the HTTPS VS.

I tried the switch -glob iRule before posting (I tried 6 or 7 different variations, actually, before posting…) But I was still stuck having to assign an HTTP profile to the HTTPS VS to get the rule to apply, breaking OWA.

I need to get to an LTM class!

---

<div class="post-metadata">

**Author:** ![Chris\_Miller](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/chris_miller/32/14702_2.png) [@Chris\_Miller](https://community.f5.com/u/Chris_Miller)\
**Post date:** [March 14, 2011, 1:51pm UTC](https://community.f5.com/t/redirect-to-pool-based-on-incoming-https-uri/1994/6 "2011-03-14T13:51:18Z")

</div>

You’re correct in that you’ll need the iRule applied to HTTPS traffic as well. Also, as your rule looks at HTTP info (path) you’ll need the HTTP profile. If you do a packet capture, is traffic getting to your pool members? Are you just using a clientSSL profile on your HTTPS VIP?

---

<div class="post-metadata">

**Author:** ![Michael\_Yates](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@Michael\_Yates](https://community.f5.com/u/Michael_Yates)\
**Post date:** [March 14, 2011, 6:15pm UTC](https://community.f5.com/t/redirect-to-pool-based-on-incoming-https-uri/1994/7 "2011-03-14T18:15:45Z")

</div>

I’ve had similar problems to what you are describing in the past. The problems that I had were revolved around a default behavior in the HTTP Profile (Response Rechunking). Some traffic doesn’t respond well to it.

I would suggest creating and applying a custom HTTP Profile and trying different chunking options to see if this fixes your problem.

I did check my OWA Virtual Server settings and we are using the default HTTP Profile (with the default Response Rechunking settings) so this is just a guess, but it sounds like you have everything else configured correctly.

---

<div class="post-metadata">

**Author:** ![Aaron\_107144](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Aaron\_107144](https://community.f5.com/u/Aaron_107144)\
**Post date:** [March 14, 2011, 8:49pm UTC](https://community.f5.com/t/redirect-to-pool-based-on-incoming-https-uri/1994/8 "2011-03-14T20:49:46Z")

</div>

I’ve managed to make some progress:

Using the iRule:

when HTTP\_REQUEST {

switch -glob [string tolower [HTTP::path]] {

“/rpc\*” -

“/oab\*” -

“/ews\*” -

“/autodiscover\*”

{ pool Exch\_OA\_Pool

}

default {

pool Exch\_OWA\_Pool

}

}

}

I also removed the pool declaration in the VS configuration - Allowing pool selection solely VIA the iRule. This works, and OWA traffic flows as required to the “Exch\_OWA\_Pool”

And I can see the OA traffic hitting the “Exch\_OA\_Pool” as designed.

This also works with the iRule I started with (If, or, or, or, or), Just FYI for the next guy…

I’m still having trouble with the traffic, but at least it’s hitting the OA TMG pool now! I may have more questions, but I have to do a little more research to make sure they aren’t too newb-ish 😉

Thanks guys! I appreciate the help.
