Forum Discussion
dp_119903
Cirrostratus
I used the example above and it works...but it only works if the user is going to the home page. I'm not a web guy so bear with me, but what I'm trying to say is that if the user goes to:
and the site is down it redirects it to the apology page.
But if the user goes to www.site.com/site/default.aspx then it doesn't redirect. Is there a way to make it so if the user goes to "any" URL within the site that it will redirect to the apology page? I can actually make that work using a basic apology page, but I can't get it to work with this example that uses the ifile to call the image.
What I can get to work is:
when LB_FAILED {
if { [active_members [LB::server pool]] < 1 } {
HTTP::respond 200 content [ifile get "sharepoint_apology"]
} else { discard }
}
...but that doesn't allow me to display an image.
What I'm currently using is:
when HTTP_REQUEST {
if {[active_members [LB::server pool]] < 1} {
switch [HTTP::uri] {
"/" { HTTP::respond 200 content [ifile get "sharepoint_apology"] }
"/sharepoint_apology_pic" { HTTP::respond 200 content [ifile get "sharepoint_apology_pic"] }
}
}
}
Thanks,
David
Dmitriy_Sysoev
Feb 01, 2014Nimbostratus
Hi! You need to tell browser what is the content of your files. My examples:
when HTTP_REQUEST {
if { ([active_members /E_Click/clk2_app]) < 1 || ([active_members /E_Click/clk2_login]) < 1} {
switch [string tolower [HTTP::uri]] {
"/facebook.png" {
HTTP::respond 200 content [ifile get "facebook.png"] "Content-Type" "image/jpeg"
}
"/link_separator.gif" {
HTTP::respond 200 content [ifile get "link_separator.gif"] "Content-Type" "image/gif"
}
"/logo.gif" {
HTTP::respond 200 content [ifile get "logo.gif"] "Content-Type" "image/gif"
}
"/logo2.gif" {
HTTP::respond 200 content [ifile get "logo2.gif"] "Content-Type" "image/gif"
}
"/logo3.gif" {
HTTP::respond 200 content [ifile get "logo3.gif"] "Content-Type" "image/gif"
}
"/logo4.gif" {
HTTP::respond 200 content [ifile get "logo4.gif"] "Content-Type" "image/gif"
}
"/offline_click.jpg" {
HTTP::respond 200 content [ifile get "offline_click.jpg"] "Content-Type" "image/jpeg"
}
"/ppl.jpg" {
HTTP::respond 200 content [ifile get "ppl.jpg"] "Content-Type" "image/jpeg"
}
"/t.gif" {
HTTP::respond 200 content [ifile get "t.gif"] "Content-Type" "image/gif"
}
"/twitter.png" {
HTTP::respond 200 content [ifile get "twitter.png"] "Content-Type" "image/png"
}
"/vkontakte.jpg" {
HTTP::respond 200 content [ifile get "vkontakte.jpg"] "Content-Type" "image/jpeg"
}
"/" {
HTTP::respond 200 content [ifile get "click_not_available.htm"] "Content-Type" "text/html"
}
}
}
else {
HTTP::respond 302 Location "https://xxxxxxxxxx.ru/"
}
}