Forum Discussion
rdessert_76127
Nimbostratus
Aug 28, 2013Strange Behavior With Maintenance Page Redirect iRule
Hello,
I've been asked to redirect several websites, all of which are subdomains of a domain (ie. x.site.com, y.site.com, and z.site.com), to a maintenance page when we perform maintenance in th...
Aug 28, 2013
A couple of problems.
1) You are not adding the protocol in the Location header so the browser is thinking it's a relative link and thus appending it to the new URL.
2) If your iRule is on www.site.com, the redirect is going back through the iRule which is then issuing another redirect - thus the firefox infinite loop error.
You might try something like this
when HTTP_REQUEST {
Check host for potential redirect
if { [HTTP::host] contains ".site.com" } {
Avoid recursive redirects
if { ! ([HTTP::uri] ends_with "/site-down.php") } {
HTTP::redirect does a 302 redirect for you.
HTTP::redirect "http://www.site.com/c/site-down/site-down.php"
}
}
}
Hope this helps...
-Joe
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