Forum Discussion
cjunior
May 19, 2020Nacreous
Hello,
Perhaps this example will cover your needs:
when HTTP_REQUEST {
set uri [HTTP::uri]
if { [HTTP::path] starts_with "/accounting" } {
pool accounting_servers
}
elseif { [info exists goto_legacy] } {
unset goto_legacy
pool legacy_servers
} else {
pool responsive_servers
}
}
when LB_SELECTED {
log local0. "URI: $uri | Selected pool: [LB::server pool]"
}
when HTTP_RESPONSE {
if { [HTTP::status] eq 404 } {
if { [LB::server pool] ends_with "responsive_servers" } {
set goto_legacy 1
HTTP::respond 302 -version auto noserver Location $uri X-Retry-Response 404
}
}
}
It flags a variable on failed attempt to responsive servers and then redirect to new attempt on legacy servers using the same connection.
Maybe that helps but I don't know it's the best thing to do. (But I can't think of another 😕 )
Please, tell me if it solves or there are a better solution.
Kind regards.