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 pag...
Hamish
Cirrocumulus
Aug 02, 2010If 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
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