Forum Discussion
Kesh_152548
Nimbostratus
May 01, 2014HTTPS redirects
Hello,
I am a complete novice as far as f5 devices are concerned, and I need to achieve the following:
Any traffic to http://testssl.mydomainmail.co.uk gets redirected to https://testssl.mydomai...
nitass
Employee
May 01, 2014e.g.
config
[root@ve11a:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
if { [HTTP::host] eq "testssl.mydomainmail.co.uk" } {
switch [string tolower [HTTP::path]] {
"/" {
HTTP::redirect "https://testssl.mydomain.co.uk/login"
}
default {
HTTP::redirect "https://testssl.mydomain.co.uk[HTTP::uri]"
}
}
} elseif { [HTTP::host] eq "testssl.mydomain.co.uk" } {
switch -glob [string tolower [HTTP::path]] {
"/login" -
"/???lz/*" {
HTTP::redirect "https://testssl.mydomain.co.uk[HTTP::uri]"
}
}
}
}
}
test
[root@ve11a:Active:In Sync] config curl -I http://testssl.mydomainmail.co.uk
HTTP/1.0 302 Found
Location: https://testssl.mydomain.co.uk/login
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve11a:Active:In Sync] config curl -I http://testssl.mydomainmail.co.uk/anythingbhabhabha
HTTP/1.0 302 Found
Location: https://testssl.mydomain.co.uk/anythingbhabhabha
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve11a:Active:In Sync] config curl -I http://testssl.mydomain.co.uk/login
HTTP/1.0 302 Found
Location: https://testssl.mydomain.co.uk/login
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve11a:Active:In Sync] config curl -I http://testssl.mydomain.co.uk/123lz/anythingbhabhabha
HTTP/1.0 302 Found
Location: https://testssl.mydomain.co.uk/123lz/anythingbhabhabha
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
- Kesh_152548May 21, 2014
Nimbostratus
That worked partially: Any traffic to http://testssl.communigatormail.co.uk gets redirected to https://testssl.communigator.co.uk/login - Doesn’t work Any traffic to http://testssl.communigatormail.co.uk/anything gets redirected to https://testssl.communigator.co.uk/anything (where “anything” could be any URL) - Doesn’t work Any traffic to http://testssl.communigator.co.uk/login gets redirected to https://testssl.communigator.co.uk/login - Works Any traffic to http://testssl.communigator.co.uk/xxxlz/ anything gets redirected to https://testssl.communigator.co.uk/xxxlz/ anything (where xxx can be anything) - Works I'm wondering if switch -glob should be used in the earlier command?
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