Forum Discussion
natewood70
Nimbostratus
Mar 10, 2015HTTP redirect working - now trying to setup HTTPS redirect
Hey Everyone!
First and foremost, this is an amazing support community. I'm pretty new to the F5's and a ton of posts have been extremely helpful in guiding me through what configurations are ne...
nitass
Employee
Mar 10, 2015what kunjan said is the irule should be usable for both http and https virtual server. what you need on https virtual server is clientssl profile (to decrypt) and serverssl profile (to re-encrypt in case serer is https).
e.g.
configuration
root@(ve11c)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar*
ltm virtual bar80 {
destination 172.28.24.10:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 11
}
ltm virtual bar443 {
destination 172.28.24.10:443
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
clientssl {
context clientside
}
http { }
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 10
}
root@(ve11c)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm pool foo
ltm pool foo {
members {
200.200.200.101:80 {
address 200.200.200.101
}
}
}
root@(ve11c)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
if { [HTTP::host] equals "myfriendlyurl.com" } {
HTTP::redirect "https://myunfriendlyurl.com[HTTP::uri]"
}
}
}
test
[root@ve11c:Active:In Sync] config curl -I http://myfriendlyurl.com/something
HTTP/1.0 302 Found
Location: https://myunfriendlyurl.com/something
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve11c:Active:In Sync] config curl -Ik https://myfriendlyurl.com/something
HTTP/1.0 302 Found
Location: https://myunfriendlyurl.com/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