Forum Discussion
mop10011_63574
Nimbostratus
Mar 08, 2009how to rewrite fallback page
Say I have these pools on my F5 ltm:
poolone, pooltwo, poolthree
The dns to get to each of these respectively is:
www.one.com
www.two.com
www.three.com
All three pools use the same Profile named "maintenance". The maintenanace profile has a Fallback Host of http://www.four.com/notices/maintenance.html.
When the user is directed to the fallback host, is there any way on the F5 to rewrite the url the user sees in the address bar, such that instead of seeing:
"http://www.four.com/notices/maintenance.html"
the user would see one of these:
"http://www.one.com/notices/maintenance.html"
"http://www.two.com/notices/maintenance.html"
"http://www.three.com/notices/maintenance.html"
Thanks, Mark
- hoolio
Cirrostratus
Hi Mark,when HTTP_REQUEST { Set the fallback host based on the requested host. HTTP::fallback "http://[HTTP::host]/notices/maintenance.html" }
- mop10011_63574
Nimbostratus
Thanks Aaron and Denny. You are correct Denny, I want the browser to display a different URL than what I'm directing them to. It's a little confusing when a user attempts to go to www,one.com, it's down, and they are directed to www.four.com for the maintenance notice. - hoolio
Cirrostratus
I think I missed the original point then. If you want to transparently rewrite requests so that the client gets "maintenance page" content when the default pool of the VIP is down, you can use a rule like this (Click here๐when RULE_INIT { Use a prefix for the path that does not already exist in the application set ::maintenance_prefix "/maintenance/" The default maintenance page set ::maintenance_page "maintenance.html" } when CLIENT_ACCEPTED { Save the name of the default pool on the VIP set default_pool [LB::server pool] } when HTTP_REQUEST { Check if there aren't any active members in the default pool if { [active_members $default_pool] < 1 } { Primary members are unavailable. Check if the URI has not already been rewritten. if {not ([HTTP::path] starts_with $::maintenance_prefix)}{ Rewrite the URI to the maintenance prefix/maintenance page (/maintenance/maintenance.html) HTTP::uri "$::maintenance_prefix$::maintenance_page" } Use the maintenance pool pool maintenance_pool } else { Use the VIP's default pool pool $default_pool } }
- hoolio
Cirrostratus
Note: As the client is not being redirected, you would want to set the maintenance pool members to set appropriate caching headers to prevent the client from caching the maintenance content. This would ensure that the client (or an intermediate proxy) does not cache the maintenance content for the production URIs. - mop10011_63574
Nimbostratus
Thanks a lot Aaron. This iRule does exactly what I want.
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