Forum Discussion
adharkrader
Nimbostratus
Aug 02, 2010Fallback: which VS failed?
Since we were originally a Cisco shop, have a "sorry server" for all failed applications. In the Cisco environment, you still appear to be at the hostname you intended, so it's easy for the sorry page to be app-specific.
Since the F5 fallback is a redirect, how can I reproduce that app-specificity? I'd like to do it in a generic way from my parent profile, like changing the fallback host to } or ] or some such dynamic replacement, rather than tweaking the fallback host for every VS.
Anybody done anything like that? Some other method I'm overlooking?
Thanks - Al
13 Replies
- Chris_Miller
Altostratus
I haven't done much with the fallback host. But you could certainly do an iRule that redirected to [HTTP::host] if your pool members were all down. - Hamish
Cirrocumulus
If you don't want to redirect to a different host, you can store the contents of a replacement page in a DataGroup and then redirect to that and server the content from the exact same host.
Depending on your iRule you use to server the pages, you could make it quite complex... e.g.This is for serving files from DataGroups as yhough they were on a local filesystem For v10... Enable timing measurements... timing on Make sure this iRule runs before any other standard iRules by changing the default priority from 500 to 400... priority 400 when RULE_INIT { log local0. "rule loading..." set static::lf_optionsDefault "localFilePrefsDEFAULT" set static::lf_loghost "127.0.0.1" log $static::lf_loghost local0. "Using $static::fl_optionsDefault for DEFAULT options" } when CLIENT_ACCEPTED { set lf_clientip [IP::client_addr] set lf_clientport [TCP::client_port] set lf_options "localFilePrefs[virtual name]" set static::lf_serviced 0 set hsl [HSL::open -proto UDP -pool netflow-syslog] if {! [class exists $lf_options]} { V9.. if {! [info exists $clname]} set lf_options $static::lf_optionsDefault } set fl_debugFlag [findclass "debug" $::SynapseFiltersPref " "] set lf_debugFlag [class search -value -all $lf_options equals "debug" ] if { $lf_debugFlag >= 2 } { log local0. "$lf_clientip:$lf_clientport ACCEPTED" HSL::send $hsl "$lf_clientip:$lf_clientport ACCEPTED" } } when HTTP_REQUEST { set fl_debugFlag [findclass "debug" $::SynapseFiltersPref " "] set lf_debugFlag [class search -value -all $lf_options equals "debug" ] set lf_contentClass [class search -value -all $lf_options equals "content" ] if { $lf_debugFlag >=2 } { HSL::send $hsl "$lf_clientip:$lf_clientport URI [HTTP::uri]" } Retrieve the login form from a base64 encoded external class file Pull just the filename from the path... So we need to get rid of the leading '/'. set lf_file [substr [HTTP::path] 1] if { $lf_debugFlag >=2 } { HSL::send $hsl "$lf_clientip:$lf_clientport Checking for $lf_file in DG $lf_contentClass" } v9 set lf_ResponseData [findclass $lf_file $::loginForm_test " "] set lf_ResponseData [class search -value $lf_contentClass equals "$lf_file"] if { $lf_ResponseData ne "" } { There's 2 fields... set lf_MimeType [getfield $lf_ResponseData " " 1] set lf_Content [b64decode [getfield $lf_ResponseData " " 2]] if { $lf_debugFlag >=2 } { HSL::send $hsl "$lf_clientip:$lf_clientport Serving $lf_MimeType for $lf_file" } HTTP::respond 200 content $lf_Content "Content-Type" "$lf_MimeType" Don't process any more iRules... And close the connection after the response... set static::lf_serviced 1 } elseif { $lf_debugFlag >=2 } { HSL::send $hsl "$lf_clientip:$lf_clientport Nothing found ($lf_ResponseData)... Pass Through.." } }
The DG contens themselves consist of key/value entries (String type) where the key is the 'filename' and the contents are two space separate fields. The first is the mimetype, the second is a base64 encoded file.
H - adharkrader
Nimbostratus
Fallback host works great to get people to the sorry server... I just want to know which application/server/hostname/VS/whatever they were trying to reach in the first place and that's lost by the redirect, so, some trickery is required... - Hamish
Cirrocumulus
The Referer header any good?
H - hoolio
Cirrostratus
Nice idea, Hamish. The Referer in the request to the fallback host should show the original URL. Else, I wonder if you could append the original host and URI in the HTTP profile fallback host field:
https://sorry.example.com/fallback?referer=[URI::encode [HTTP::host][HTTP::uri]]
If you try this could you post back the results?
Aaron - adharkrader
Nimbostratus
Nope. I can find no trace of my original target in the HTTP Get that arrives at the sorry server... unless I tack it on to the fallback host in the http_profile. So, I guess my question is: is there anything "dynamic" I can put in that field? Something with % signs or curly braces... (I know I can write an iRule but I was hoping for something subtler.)
Thanks - Al - adharkrader
Nimbostratus
Overlapping responses... tried to put in that encode string, no go:Bad Characters. Only the following special characters are allowed: period, asterisk, forward slash, dash, colon, underscore, question mark, equals, at sign, comma, ampersand and space (.*/-:_?=@,& )
- hoolio
Cirrostratus
It looks like the fallback host field doesn't support anything dynamic. You could either check the referer header or you could create a separate HTTP profile for each VS.
It would be useful if you could use iRule commands in the fallback host field. You might try opening a request for enhancement case with F5 to ask for this functionality to be added to the product.
Aaron - adharkrader
Nimbostratus
Unfortunately, referer is not set by the fallback redirect. I imagine that's a paradox too: should it be set to where you originally came from or to the place you were trying to get to? (Looks like they chose "do nothing".)
Ultimately, it would be nice to have something dynamic available on the fallback host field. - Hamish
Cirrocumulus
'They' (F5) didn't choose to do anything... referrer is set by your browser on a REQUEST to tell the current URL what is referring to this URL the browser is accessing...
H
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