Forum Discussion
L7 load balancing by content
We are migrating from cisco ACE. In Ace we specify class-map to use L7 load balancing as follow: class-map type http loadbalance match-all L7- 2 match http url /XDSOAPRouter/is/* class-map type http loadbalance match-any L7- 2 match http url /XDSOAPRouter/cx/.* Each content 'is' & 'cx' gow to a different pool. How can we achive that on F5?
11 Replies
- Janek_42109
Nimbostratus
Hello Krys,
You can write an iRule that depending on the uri there is a different pool selected :
https://devcentral.f5.com/questions/pool-selection-based-on-uri-string
- Krys_Frankiewic
Nimbostratus
Hi Janek, I implemented following iRule but all HTTP requests are going to the default pool SYSLOG3_pool which is set under Virtual Services Resources. How to make sure that iRule has a priority over the default pool?
when HTTP_REQUEST {
if { [HTTP::path] starts_with "/XDSOAPRouter/8t" } { pool SYSLOG_pool } if { [HTTP::path] starts_with "/XDSOAPRouter/cx" } { pool SYSLOG1_pool } if { [HTTP::path] starts_with "/XDSOAPRouter/is*" } { pool SYSLOG3_pool } }- MallariYap_1963
Nimbostratus
thanks for this!
- Bernie_Ongewe_6
Nimbostratus
Hi Krys
From 5000 feet, it looks like you're missing "elseif" and "else" expressions. Have you tried it with those in place?
Bernie
- Krys_Frankiewic
Nimbostratus
Hi Bernie, I tried "esleif", still is not working. I can't have "else" pointing to the default pool. In my case each request must be forwarded to the right pool. All my requests are going to SYSLOG1_pool which is a default pool under virtual servers.
when HTTP_REQUEST {
if {[HTTP::path] starts_with "/XDSOAPRouter/8t" } { pool SYSLOG_pool
} elseif {[HTTP::path] starts_with "/XDSOAPRouter/cx" } { pool SYSLOG1_pool } elseif {[HTTP::path] starts_with "/XDSOAPRouter/is*" } { pool SYSLOG3_pool } }- Bernie_Ongewe_6
Nimbostratus
Hmm. Could you try; } then { instead of } {
- Krys_Frankiewic
Nimbostratus
Is this correct? Because I'm getting error. if {[HTTP::path] starts_with "/XDSOAPRouter/8t" }then{ pool SYSLOG_pool
} elseif {[HTTP::path] starts_with "/XDSOAPRouter/cx" }then{ pool SYSLOG1_pool } elseif {[HTTP::path] starts_with "/XDSOAPRouter/is*" }then{ pool SYSLOG3_pool } }01070151:3: Rule [/Common/L7-test] error: /Common/L7-test:2: error: [parse error: extra characters after close-brace][then{ pool SYSLOG_pool } elseif {[HTTP::path] starts_with "/XDSOAPRouter/cx" }then{ pool SYSLOG1_pool } elseif {[HTTP::path] starts_with "/XDSOAPRouter/is" }then{ pool SYSLOG3_pool }] /Common/L7-test:4: error: [parse error: extra characters after close-brace][then{ pool SYSLOG1_pool } elseif {[HTTP::path] starts_with "/XDSOAPRouter/is*" }then{ pool SYSLOG3_pool }] /Common/L7-test:6: error: [parse error: extra characters after close-brace][then{ pool SYSLOG3_pool }]
- Bernie_Ongewe_6
Nimbostratus
Yeah that's wrong then :( The previous one looked better. I'll see if I can try it out real fast tomorrow
- Krys_Frankiewic
Nimbostratus
Now is working:)
when HTTP_REQUEST {
if { [HTTP::path] starts_with "/XDSOAPRouter/8t" } { pool SYSLOG_pool } if { [HTTP::path] starts_with "/XDSOAPRouter/cx" } { pool SYSLOG1_pool } if { [HTTP::path] starts_with "/XDSOAPRouter/is" } { pool SYSLOG3_pool } } - Bernie_Ongewe_6
Nimbostratus
Cheers! Bonus wildcard in the first one? I'm not sure I'd have thought of that
- Krys_Frankiewic
Nimbostratus
It could be the wildcard, I will teset later and let you know my findings. Thanks for help.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com