Direct traffic to a different pool based on HTTP or SOAP request.

Hi,

I hope someone can assist with the following problem:

F5 Configuration:

Single VS: 1.1.1.1

URL: http://www.domain.com/

URI: /app

Port: 443

Associated Pools: Pool A (servers receiving HTTP request) Port 1234

Pool B (servers receiving SOAP request) Port 5678

Scenario:

Both a SOAP and/or HTTP request will hit the same virtual server with the same URL and URI, separation via source IP address is not possible. A HTTP request must go to Pool A, while a SOAP request must go to Pool B.

Please see a traffic flow diagram here: 133hang qi xian1hao huan wang shi1330101qin chuang yuan C qu1pei kai guan (2) — Postimages

Any ideas on how to sperate the traffic to different pools?

Your help is greatly appreciated.

Regards,

Will

How about this:

when HTTP_REQUEST {
    if { [HTTP::header exists SOAPAction] }{
        pool Pool_B
    }
    else {
        pool Pool_A
    }
}

Thanks Brian!

One thing I didn’t mention was that the VS is also used for other services, so the iRule must only divert traffic going to the URI of /app

Can this be incorporated in the same iRule?

Can this be incorporated in the same iRule?yes, you can check uri before.

e.g.

when HTTP_REQUEST {
   if {[string tolower [HTTP::uri]] starts_with "/app"} {
      if {[HTTP::header exists SOAPAction]} {
         pool Pool_B
      } else {
         pool Pool_A
      }
   }  
}

If you’re only selecting a pool in some of the iRule cases, make sure to add a OneConnect profile to the virtual server to ensure each HTTP request is load balanced to the correct pool.

Aaron

Thats great. Worked a treat. Thanks guys!