Forum Discussion
Camdigs_13235
Nimbostratus
Jun 16, 2008maintain persistence (direct/redirect) using tag info
Good Afternoon,
I am a noob with iRules, so I appologize for asking a silly question, but here goes:
I have an application that is a conferencing app, and when a user connects to the application, any one of the servers can redirect to other servers for a specific conference id (the application dev team built in there own least conns mechanism within there app). Right now they use specific FQDN's to redirect to.
My task is to put some F5 6400's in, and use the least cons mechanism, then use the F5 to take header info sent to the client to direct the session to the correct server once the app does the backend thing. So each response from the individual servers will contain something like "serverID=0001" where 0001 is mapped to a specific pool member.
Here's what my noob brain picked out so far:
when HTTP_REQUEST {
if {[HTTP::uri] equals {cs.conferenceservers.com/}} {pool csmember1}
}
}
but I realize that this isn't right, I think I need something like a contains , or something like that within the URI
Any help would be greatly appreciated.
- Camdigs_13235
Nimbostratus
So here's an update: - Colin_Walker_12Historic F5 AccountFor that kind of list I'd either use a switch statement or a class. The switch statement is probably the fastest, but the class will be the simplest code, and easiest to update.
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "*cs-A010305*" { node 10.1.3.5 81 } "*ds-A010305*" { node 10.1.3.6 81 } "*ms-A010305*" { node 10.1.3.7 81 } "*cs-A010308*" { node 10.1.3.8 81 } "*ds-A010308*" { node 10.1.3.9 81 } "*ms-A010308*" { node 10.1.3.10 81 } "*cs-AC1E0080*" { node 10.1.3.2 81 } "*ds-AC1E0080*" { node 10.1.3.3 81 } "*ms-AC1E0080*" { node 10.1.3.4 81 } } }
class nodeMapping { "cs-A010305 10.1.3.5" "ds-A010305 10.1.3.6" "ms-A010305 10.1.3.7" "cs-A010308 10.1.3.8" "ds-A010308 10.1.3.9" "ms-A010308 10.1.3.10" "cs-AC1E0080 10.1.3.2" "ds-AC1E0080 10.1.3.3" "ms-AC1E0080 10.1.3.4" }
when HTTP_REQUEST { set nodeIP [findclass [string tolower [HTTP::uri]] $::nodeMapping " "] if { [string length $nodeIP] > 0 } { node $nodeIP 81 } }
- Camdigs_13235
Nimbostratus
Thanks Collin, Much appreciated, I will give it a go. - Eric_Oakeson_68
Nimbostratus
Colin, - Eric_Oakeson_68
Nimbostratus
Thanks Colin! We'll give that one a shot. We noticed that too but didn't know enough about code to really figure it out. - Camdigs_13235
Nimbostratus
Hi Collin,
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