First off I am an iRule newbie. I am having a bit of an issue with a trailing “/” in a redirect.
when HTTP_REQUEST {
if { [HTTP::uri] equals "/abc/" }{
HTTP::respond 301 Location "">
}
if { [HTTP::uri] equals "/abc" }{
HTTP::respond 301 Location "">
}
This is only a portion of the full rule. The issue is that when entering This Place the redirect works. However when entering http://www.thisplace.com/abc/, the redirect does not work. There are several other statements in the rule that are working without the trailing “/”.
First, a switch statement is probably a better route. They are, I’m told, much faster in iRules than ifs. I’m also not sure what the second part of that responder is about (the “>http…”).
GET /abc HTTP/1.0
HTTP/1.0 301 Moved Permanently
Location: ">http://www.someplace.com/blah/blah/
Server: BigIP
Connection: close
Content-Length: 0
GET /abc/ HTTP/1.0
HTTP/1.0 301 Moved Permanently
Location: ">http://www.someplace.com/blah/blah/
Server: BigIP
Connection: close
Content-Length: 0