Forum Discussion
Davean_Hosang_1
Nimbostratus
Aug 05, 2013multiple URI redirects
Hello,
I will be migrating a .NET environment with approximately 300 parent web directories. We will need to look at the parent web directory of the application, change the hostname and l...
nitass
Employee
Aug 28, 2013shouldn't it be findclass (rather than starts_with matchclass) in if-condition?
e.g.
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.252:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve10:Active] config b class my_datagroup list
class my_datagroup {
{
"/parentdirectory1/ hostname1"
"/parentdirectory2/ hostname2"
}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
set newhost [findclass [string tolower [URI::path [HTTP::uri] 1 1]] my_datagroup " "]
if { [string tolower [HTTP::host]] equals "hostname.com" and $newhost ne "" } {
HTTP::redirect "http://$newhost[HTTP::uri]"
}
}
}
[root@ve10:Active] config curl -I http://172.28.19.252/ -H "Host: hostname.com"
HTTP/1.1 200 OK
Date: Thu, 29 Aug 2013 01:29:46 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Thu, 23 May 2013 00:28:46 GMT
ETag: "4185a8-59-c3efab80"
Accept-Ranges: bytes
Content-Length: 89
Content-Type: text/html; charset=UTF-8
[root@ve10:Active] config curl -I http://172.28.19.252/parentdirectory1/something -H "Host: hostname.com"
HTTP/1.0 302 Found
Location: http://hostname1/parentdirectory1/something
Server: BigIP
Connection: Keep-Alive
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