Forum Discussion
cpmurphy-3_1754
Nimbostratus
Nov 05, 2014Issue with HTTP::URI with trailing /
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 { [HT...
R_Marc
Nimbostratus
Nov 05, 2014First, 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...").
This would cover both of the above scenarios:
switch -glob [HTTP::uri] {
"/abc*" {
HTTP::respond 301 Location "
}
}
Response:
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
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