Forum Discussion
lardyboy_lardyb
Nimbostratus
Apr 27, 2005BEA Weblogic and specific failover using iRules
Can anybody out there help me???????
I need to be able to query a string in the HTTP header to determine the persistamce to a server, and it's corresponding backup (v9.0.4)
...
JRahm
Admin
Apr 27, 2005I'd start here from another post:
rule WeblogicJSessionPersist {
when CLIENT_ACCEPTED {
set add_persist 1
}
when HTTP_RESPONSE {
if { [HTTP::cookie exists "JSESSIONID"] and $add_persist } {
persist add uie [HTTP::cookie "JSESSIONID"]
set add_persist 0
}
}
when HTTP_REQUEST {
if { [HTTP::cookie exists "JSESSIONID"] } {
persist uie [HTTP::cookie "JSESSIONID"]
} else {
set jsess [findstr [HTTP::uri] "jsessionid" 11 ";"]
if { $jsess != "" } {
persist uie $jsess
}
}
}
}
What you're trying to do is pull out the server names from the cookie. I'm not really familiar with all the fields, but our version looks like this:
JSESSIONID=!!!!!!!;
I'm not schooled enough with tcl to instruct you on pulling out the strings between the 2nd and 3rd ! terminator and the 5th and 6th ! terminator and pushing them into variables. You might want to build a class to match your server names as seen in the cookie to IP's so you'll have them available to persist correctly. That would look something like:
when rule_init {
array set ::server_definitions {
server1_name 10.1.1.1
server2_name 10.1.1.2
}
}
Then in the HTTP_REQUEST event, you could set variables with the primary and secondary servers from the cookie, get the actual IPs, then use that to persist, primary in the if statement and secondary in the elseif, else if nothing matches.
I wish I had the coding experience to help you, I like to participate in the creation of rules, though, it helps me get better.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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