Forum Discussion
Tony_Kitzky_936
Aug 24, 2013Nimbostratus
How best to accomplish HTTP redirection for specific URLs?
I am trying to create a site where some URLs are not redirected to HTTPS but all other URLs do get redirected. I do not know what is the best method to accomplish this. I want the ability to easily a...
nitass
Employee
Can you use regex in these data groups? I will want to match a common 3 digit string in each URI but the digits will change over time. Also I would want to ignore case on these URIs.
what about this?
e.g.
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm virtual bar
ltm virtual bar {
destination 172.28.20.111:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
myrule
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 23
}
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm rule myrule
ltm rule myrule {
when HTTP_REQUEST {
set path [string tolower [HTTP::path]]
switch -glob $path {
"/slowcomputer/is/slow/index.html" -
"/notso/fastcomputer/is/notfast.html" -
"slownotebook/is/slow/nossl/index.html" -
"/slow[0-9][0-9][0-9][0-9][0-9]/nossl/is/slow/myhome.svc" {
do nothing
}
default {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
}
}
[root@ve11a:Active:Changes Pending] config curl -I http://172.28.20.111/slowcomputer/is/slow/index.html
HTTP/1.1 404 Not Found
Date: Sun, 25 Aug 2013 01:28:50 GMT
Server: Apache/2.2.3 (CentOS)
Content-Type: text/html; charset=iso-8859-1
[root@ve11a:Active:Changes Pending] config curl -I http://172.28.20.111/SLOW54321/nossl/is/slow/myhome.svc
HTTP/1.1 404 Not Found
Date: Sun, 25 Aug 2013 01:31:45 GMT
Server: Apache/2.2.3 (CentOS)
Content-Type: text/html; charset=iso-8859-1
[root@ve11a:Active:Changes Pending] config curl -I http://172.28.20.111/somethingelse
HTTP/1.0 302 Found
Location: https://172.28.20.111/somethingelse
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
nitass
Aug 25, 2013Employee
i understand we cannot use regex in data group. so, we may separate those data (from data group) and check it using command such as switch glob, string match, scan, etc.
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