Forum Discussion
kng_107168
Nimbostratus
Mar 02, 2011unable to redirect to a different page on another pool
This is what I have but the client browser doesn't seems to like the redirection.
when HTTP_REQUEST {
if { [active_members poolA] < 1 } {
use pool poolB
HTTP::redire...
hoolio
Cirrostratus
Mar 03, 2011I think Chris' original example should work if the splash.html page doesn't reference any other objects on the same fully qualified domain name. HTTP_REQUEST will be triggered regardless of whether there is a pool on the virtual server or whether the pool is up.
You could also use the VS default pool instead of hardcoding poolA.
when CLIENT_ACCEPTED {
Save the name of the VS default pool
set default_pool [LB::server pool]
}
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] to [HTTP::host][HTTP::uri]"
if { [active_members $default_pool] < 1 } {
log local0. "[IP::client_addr]:[TCP::client_port]: No members for $default_pool. Rewriting URI to /splash.html and using poolB"
pool poolB
HTTP::uri /splash.html
}
}
If that doesn't work, check the /var/log/ltm debug to see what's happening. I'd guess the issue is with content referenced in /splash.html getting rewritten to /splash.html. If that's the case, then you could move /splash.html to a new unique subdirectory and use something like this:
when CLIENT_ACCEPTED {
Save the name of the VS default pool
set default_pool [LB::server pool]
}
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] to [HTTP::host][HTTP::uri]"
if { [active_members $default_pool] < 1 || [HTTP::uri] starts_with "/maintenance/"} {
log local0. "[IP::client_addr]:[TCP::client_port]: No members for $default_pool. Rewriting URI to /maintenance/splash.html and using poolB"
pool poolB
HTTP::uri "/maintenance/splash.html"
}
}
This latter example would work assuming any objects splash.html references are relative to the current path.
Aaron
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
