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.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.." } }
- 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? - 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: - 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.) - 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. - 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".) - 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...
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