Forum Discussion
TCL Expected Boolean Error
Looked on the forums for this particular error and maybe some way to resolve it. Unfortunately there isn't much on the way of this problem. Hoping someone a little better at iRules than I can help me out. Trying to get this rule to work. The idea is that if someone tries to hit any of the host URLS it redirects to 1 specific one, but keeps the URI.
Code
when HTTP_REQUEST {
if {{ [HTTP::host] contains "unstable"} || { [HTTP::host] contains "services"} || { [HTTP::host] contains "e2"}} {
HTTP::redirect { "host.server.com/[HTTP::uri]" }
} else {
HTTP::respond 403
}
}No matter what I try, I either get an expected boolean error or it makes the f5 hang for a while then kind of turn back on. Any help would be appreciated. Thanks.
6 Replies
- nitass_89166
Noctilucent
can you try this?
when HTTP_REQUEST { if { [HTTP::host] contains "unstable" || [HTTP::host] contains "services" || [HTTP::host] contains "e2" } { HTTP::redirect "http://host.server.com[HTTP::uri]" } else { HTTP::respond 403 } }- adransfield_177
Nimbostratus
- nitass
Employee
can you try this?
when HTTP_REQUEST { if { [HTTP::host] contains "unstable" || [HTTP::host] contains "services" || [HTTP::host] contains "e2" } { HTTP::redirect "http://host.server.com[HTTP::uri]" } else { HTTP::respond 403 } }- adransfield_177
Nimbostratus
- Eric_St__John
Employee
DevCentral is apparently having some issues interpreting code. As you pointed out, you have to remove:
""> andGive that a shot.
- nitass
Employee
I had to remove the pipe between "server.com" and "[HTTP::uri]" because it just inserted "%7C" in the url bar and the server kept getting confused.
oop sorry it is my cursor.
Now it keeps saying there is a redirect loop and it adds like 20 forward slashes.
is the actual host.server.com resolved to the same virtual server? if yes, it will cause loop if the actual host.sever.com matches the if condition again.
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