Terrence
Jul 09, 2009Nimbostratus
Writing a generic Irule
A while back I took the LTMMaintenancePage to serve up a maintenance page for the web application. We are about to load balance a second application and would also like to use the maintenance page. Although not fully tested I was able to substitute the Description with the hostname with the following code.
set site_name [HTTP::host]
set index_html [string map "SITE $site_name" ${::template}]
This isn't ideal as something HTTP:host is not the "name" of the application. What I would like to do is have a variable persist upon virtual server similar to the STATS profiles, however I want a string which I could then substitute into the template.
also I currently have three lines
set site_name [HTTP::host]
set index_html [string map "SITE $site_name" ${::template}]
HTTP::respond 200 content $index_html "Content-Type" "text/html"
Can anyone show me the proper brackets to put it all in a one liner?
HTTP::respond 200 content [string map "SITE [HTTP::host]" ${::template}] "Content-Type" "text/html"
I unfortunately do not have a test box to test on(its currently in paperwork somewhere), but we have a maintenance window this weekend which I can have some time to do some testing.
References:
http://devcentral.f5.com/wiki/default.aspx/iRules/LTMMaintenancePage.html