I wrote a little IRule to test how we can realise a retry if the webserver returns an 404-Error.
If the page is not found on the webserver, the url will be modified in the HTTP_Response-Event another pool is selected and the request will be send back to the webservers.
Everything works fine. The only problem is, that always the same member of the pool is selected.
The load-balancing-methode is Round Robin.
Persistens is disabled.
I also tried to delete the keep-alive string in the request.
What else can I do.
Thanks
steve
***************************************************
timing on
when HTTP_RESPONSE {
log local. “Response-Server=[LB::server pool] [LB::server name]”;
log local. “There are [active_nodes d.faz.net] active nodes in the pool.”
if { [HTTP::status] eq “404”} {
log local. “found 404 Response”;
set lowerReq [string tolower $request];
if {$lowerReq contains “_test/”} {
set startPos [string first “_test/” $lowerReq];
set endPos [string length “_test/”];
set endPos [expr $startPos + $endPos - 1];
set newRequest [string replace $request $startPos $endPos “/”];
log local. “newRequest = $newRequest”;
HTTP::retry $newRequest
}
}
}
when HTTP_REQUEST {
set NewPool “”;
set path [HTTP::path];
set request [HTTP::request]
if { $::DEBUG } {
log local. “There are [active_nodes xxxx] active nodes in the pool xxxx”;
log local. “Request number [HTTP::request_num], Client: [IP::remote_addr]:[TCP::remote_port] , Status: [LB::status]”;
}
persist none; persist none ist default
if { $path starts_with “/y/” } {
set NewPool “yyyy”;
}
elseif { $path ends_with “.asp” } {
set NewPool “aspPool”;
}
elseif { $path ends_with “.aspx” } {
set NewPool “aspxPool”;
} else {
set NewPool “vvvv”;
}
pool $NewPool;
}
when LB_SELECTED {
if {[LB::server pool] ne $NewPool} {
if the new Request is started using LB:retry
“pool $NewPool;” doesnt work in HTTP_REQUEST
so in this case we do a reselect here
log local. “doing reselect $NewPool”;
reselect works fine, but why is it alwayse the same pool-member
load-balancing-methode is Round Robin
http://devcentral.f5.com/wiki/default.aspx/iRules/LB\_\_reselect.htmlDescription
Selects the next available member in the specified pool, based on the Load Balancing options of that pool
LB::reselect pool $NewPool;
} else {
log local. “Pool=$NewPool, Server=[LB::server pool], Uri=[HTTP::uri]”;
}
}