Forum Discussion
ukstin
Nimbostratus
Jun 09, 2008conditional redirect (404)
Hi people,
I´m trying to wrote a i-rule to redirect a 404 error based on the url. The i-rule I made is this one:
when HTTP_REQUEST {
set host [HTTP::host]
set url [HTTP::uri]
}
when HTTP_RESPONSE {
set status_code [HTTP::status]
if { $status_code equals 404 } {
if { $host contains "abcd" } {
HTTP::redirect "http://abcd.otherdomain.com/$url"
}
elseif { $host contains "efg" } {
HTTP::redirect "http://efg.otherdomain.com/$url"
}
else {
HTTP::redirect "http://anotherone.com/xyz.html"
}
}
}
it seens ok to me and it works almost every time, but sometimes I received the following error:
Jun 9 19:25:07 tmm tmm[1133]: 01220001:3: TCL error: Rule irule_redirect_404 - can't read "host": no such variable while executing "if { $host contains ..."
any ideas why the host variable doesn´t work sometimes?
4 Replies
No RepliesBe the first to reply
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