Forum Discussion
Redirect a VS via irule
We are running a Bigip v11.4.1 build 647.0
I would like to redirect a VS that we have on our F5 to a different url. For example, the user points their browser to www.school.com. The VS that corresponds to www.school.com has an irule assigned to it. I would like the irule to put up a quick informational web page that says that they are being redirected to www.highschool.com because www.school.com has been retired. The informational page should wait a few seconds so they can read it (maybe 5 seconds), then redirect them to www.highschool.com. I tried the following irule, but it just redirects without showing them the informational web page:
when HTTP_REQUEST { set delay 5 HTTP::respond 200 content "https://www.highschool.com/> The Test site www.school.com has been retired. After 5 seconds, youll automatically be redirected to our new home page at www.highschool.com. " "Content-Type" "text/html" }
What am i doing wrong? Or is there a better way to do this on the F5?
4 Replies
- StephanManthey
Nacreous
Hi Danny,
do you see error messages in /var/log/ltm when the iRule is triggered?
("tail -f /var/log/ltm")
I believe it is necessary to escape all quotas in the specified content as you did with the \"REFRESH\" in the meta tag. I would also recommend to avoid the usage of the delay variable and hard code the refresh rate instead to simplify things.
Personally I prefer to put content into a $payload variable (using "append" to combine with other variable parameters) and to reference it in the HTTP::respond 200 content "$payload".
Thanks, Stephan - StephanManthey
Nacreous
The following seemed to work for me:
when HTTP_REQUEST { set page " The Test site has been retired. After 5 seconds, youll automatically be redirected to our new home page at " HTTP::respond 200 content "${page}" Content-Type "text/html" } - Danny_Arroyo
Cirrus
That worked. Thank you very much.
- StephanManthey
Nacreous
Hi Danny, I worked a bit on the iRule above and posted the result here: https://devcentral.f5.com/questions/temporary-page-with-meta-refresh-tag-to-forward-to-new-page Thanks, Stephan
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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