Forum Discussion
Joe_Pipitone
Nimbostratus
Jan 12, 2010Catch a specific URL and redirect it
I have an existing iRule which uses a switch statement to catch a request no matter the case (string tolower) and redirect.
For some reason, the iRule is not catching and redirecting - I ...
nitass
Employee
Dec 12, 2011e.g.
[root@ve1023:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if {[class match -- [string tolower [HTTP::uri]] equals uri_redirect]} {
HTTP::redirect "http://[HTTP::host][class match -value [string tolower [HTTP::uri]] equals uri_redirect]"
}
}
}
[root@ve1023:Active] config b class uri_redirect list
class uri_redirect {
{
"/1" { "/3" }
"/2" { "/3" }
"/4" { "/6" }
"/5" { "/6" }
"/7" { "/9" }
"/8" { "/9" }
}
}
[root@ve1023:Active] config curl -I http://172.28.19.79/1
HTTP/1.0 302 Found
Location: http://172.28.19.79/3
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve1023:Active] config curl -I http://172.28.19.79/2
HTTP/1.0 302 Found
Location: http://172.28.19.79/3
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve1023:Active] config curl -I http://172.28.19.79/4
HTTP/1.0 302 Found
Location: http://172.28.19.79/6
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve1023:Active] config curl -I http://172.28.19.79/5
HTTP/1.0 302 Found
Location: http://172.28.19.79/6
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve1023:Active] config curl -I http://172.28.19.79/7
HTTP/1.0 302 Found
Location: http://172.28.19.79/9
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve1023:Active] config curl -I http://172.28.19.79/8
HTTP/1.0 302 Found
Location: http://172.28.19.79/9
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve1023:Active] config curl -I http://172.28.19.79/other
HTTP/1.1 404 Not Found
Date: Mon, 12 Dec 2011 14:23:03 GMT
Server: Apache/2.2.3 (CentOS)
Connection: close
Content-Type: text/html; charset=iso-8859-1
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
