Forum Discussion
Jamey_Price_105
Nimbostratus
Nov 02, 2006Making Pool Commands Last Throughout a Session
I'm still screwing around with my reverse-proxy-webmail situation, and I've got it very nearly working... but there's a catch. Here's how it works: You go to webmail.domain.com and you are in a pool with all three internal mailservers to which you get assigned randomly. Any one of the three can authenticate you, and once the mailserver has done so it will use a javascript redirect to send you to the correct mailserver. I have a stream profile that watches for these javascript redirects, and replaces det1mail01 through 03 with webmail.domain.com/det1mail01 through 03 as appropriate. This works fine.
I then watch for the request from the redirect, which ends up in this iRule. I strip out the mailserver name, and I have a pool with the same name. I then tried to use the pool $mailserver command to send the request to the right pool, which works! However, it only works for that one request. Any future request which might not have det1mail0? in the URL still go to the original mailserver in pool webmail-tdi-com. What am I missing to make the pool switch permanent? You'll note I also tried manually setting the member of the main webmail-tdi-com pool to the correct node, which doesn't actually seem to do anything at all, as request continue going to whichever member was originally, randomly selected.
I need to have one of these two things working, either being able to make it use the totally different pool permanently or make it use the correct member of the main pool permanently if anyone has any ideas. That's my goal.
Also, in an article I found this alternate syntax for the pool command "use pool..." instead of just "pool...". Does that actually make it work any differently?
when HTTP_REQUEST {
if {[HTTP::uri] contains "det1mail0"}{
regexp /(det1mail0.*)(/mail/.*\.nsf\.*) [HTTP::uri] garbage mailserver mailfile
log "Setting pool to $mailserver and URI to $mailfile from [HTTP::uri]"
if {$mailserver equals "det1mail01"}{
LB::detach
use pool "webmail-tdi-com" member "10.50.2.21" "80"
} elseif {$mailserver equals "det1mail02"}{
LB::detach
use pool "webmail-tdi-com" member "10.50.2.22" "80"
} elseif {$mailserver equals "det1mail03"}{
LB::detach
use pool "webmail-tdi-com" member "10.50.2.23" "80"
} else {
log "Well, we've got a mailserver that isn't in the list. This is bad. Come look at this."
}
use pool $mailserver
HTTP::uri $mailfile
} else {
log "I've got a request for [HTTP::uri] that doesn't contain det1mail0 going to [LB::server]"
}
}
Thanks for your help,
Fish
No RepliesBe the first to reply
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