Forum Discussion
Robert_47833
Altostratus
May 12, 2011return and HTTP::redirect usage
Hi,I have a irule like this
if {$uri matches_regex "^/(help/)"}
{
HTTP::redirect ]
pool cjj1
return
}
else{
pool cjj2
}
1:don't kno...
richard_77048
Nimbostratus
May 16, 2011The HTTP::redirect command immediately sends the redirect response to the client. You can't set a pool after issuing this command. You are sending the client back through your loadbalancer on a new request.
Also, if $uri = [HTTP:uri], then you will be in a redirect loop since you are not altering the client request when you redirect them. If $uri != [HTTP::uri], then you need an "elseif" clause that catches the new request and uses pool cjj1.
So, like this:
when HTTP_REQUEST {
if { $uri starts_with "/help/" } {
HTTP::redirect "http://[HTTP::host][HTTP::uri]"
}
elseif { some new condition that matches your redirected request } {
pool cjj1
}
else {
pool cjj2
}
}
I haven't used "return" so I won't advise on its use.
Richard
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