Forum Discussion
Nov 17, 2010
matchclass, uri routing, and cookie persist & snat irule
Hey guys and gals, it's been a bit, I hope all is well.
Please review the below scenerio and let me know if i'm missing something, or if you would do anything differently..
I worked up the below iRule, I'd like to route traffic to one specific pool based on a class of uris, if no match, I'd like to route to another pool and use cookie persist... Simple enough.
The Virtual Server is terminating SSL and re-encrypting it.. using an client and server SSL profile..
In addition the VS is already using a snat iRule.. My thought is to juse use it first..Should I combine the snat iRule, or just keep it and use the below one after the snat iRule?
I should note, the box is running 10x on the 8900 platform.
Thanks!
iRule
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
log local0.notice "Incoming Request uri: $uri"
if { [matchclass [HTTP::uri] starts_with $::myclass] } {
log local0.notice "Directing to secure_pool"
pool match_pool
} else {
log local0.notice "Directing to server_pool"
pool server_pool
persist cookie
}
classclass myclass {
/myfirsturi
/myseconduri
/etcetcetc
}
[/
- Hmm I'm running 10.2x and "class match" would not compile..
- hoolio
Cirrostratus
Do you get an error when trying to save the iRule or during runtime when it's executed? This loaded for me on 10.2.0:when HTTP_REQUEST { if { [class match [HTTP::uri] starts_with myclass] } { log local0. "Matched" } }
- When trying to save the iRule..
- hoolio
Cirrostratus
What error do you get? Does the class exist? - hoolio
Cirrostratus
Or does the class name have a hyphen in it? If so, you could either redefine the class replacing the hyphen with an underscore, or you could probably escape it with curly braces: {my-class}. - No, only hyphen exists in the actual rule name..
- hoolio
Cirrostratus
I'm fairly certain that indicates the class myclassname doesn't exist. Can you double check that the class name is exactly the same in the iRule? Yep definitely the same.. As soon as I change "class match" to matchclass it works... odd..
- hoolio
Cirrostratus
Is the class defined as a string datagroup? Can you post an anonymized copy of the 'b class myclassname list' output? - It was defintiley the class.. thanks man
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects