Forum Discussion
Old story - maintenance page iRule
Hello,
I know this topic has been discussed many times already but there is one thing I got stuck with - is it possible to combine two of these actions into a single iRule? :
when HTTP_REQUEST {
HTTP::respond 200 content {
The site has been moved
The webiste has moved to https://aaa.aaa
Please update your bookmarks.
}
}
and this:
HTTP::respond 200 content [ifile get we_have_moved] "Content-Type" "image/gif" }
The idea is to have a tiny HTML page with ifile inserted image.
Thanks and appologies for my possible WEB-ignorance.
4 Replies
- David__Pasch
Altostratus
I think this thread may help you.
irule-maintanance-page-with-ifile
Basically, you set up an iRule with a default action that posts your HTML, with the contexts above for the subsequent content calls for the iFiles.
Hope it helps!
- FMA
Nimbostratus
Thanks David! It really helped me to get into this. Just one more thing here - I'm trying to use a variable below (REDIRECTURL) to simplify future modifications, but when I try to use it within HTTP:respond code it doesn't return variable value and just prints it as a text "$REDIRECTURL".
when HTTP_REQUEST { set REDIRECTURL "https://example.com" switch [HTTP::uri] { "/we_have_moved.png" { HTTP::respond 200 content [ifile get we_have_moved.png] "Content-Type" "image/gif" } default { HTTP::respond 200 content { The site has been moved The webiste has moved to Please update your bookmarks! You will be redirected in 50 seconds  } } } }
Is there any way to make this work?
Thanks!
- JG
Cumulonimbus
Try this then:
when HTTP_REQUEST { set REDIRECTURL "https://example.com" set message " The site has been moved The webiste has moved to Please update your bookmarks! You will be redirected in 50 seconds !\[HTML5 Icon\](we_have_moved.png) " switch [HTTP::uri] { "/we_have_moved.png" { HTTP::respond 200 content [ifile get we_have_moved.png] "Content-Type" "image/gif" } default { HTTP::respond 200 content $message } } }
- JG
Cumulonimbus
Or:
when HTTP_REQUEST { set REDIRECTURL "https://example.com" switch [HTTP::uri] { "/we_have_moved.png" { HTTP::respond 200 content [ifile get we_have_moved.png] "Content-Type" "image/gif" } default { HTTP::respond 200 content "\ The site has been moved\ The webiste has moved to \ Please update your bookmarks!\ You will be redirected in\ 50 seconds \ \ \ \ " } } }
Recent Discussions
Related Content
* 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