Forum Discussion
3 Replies
Sort By
- nitassEmployee
this is an example for http. for https, just change HTTP::redirect command from http to https.
e.g.
config [root@ve11a:Active:In Sync] config tmsh list ltm rule qux ltm rule qux { when HTTP_REQUEST { if { [HTTP::host] ends_with ".com" } { HTTP::redirect "http://[string map {.com .org} [HTTP::host]][HTTP::uri]" } } } test [root@ve11a:Active:In Sync] config curl -I http://172.28.24.10/something -H "Host: mobilebank.com" HTTP/1.0 302 Found Location: http://mobilebank.org/something Server: BigIP Connection: Keep-Alive Content-Length: 0 [root@ve11a:Active:In Sync] config curl -I http://172.28.24.10/something -H "Host: www.mobilebank.com" HTTP/1.0 302 Found Location: http://www.mobilebank.org/something Server: BigIP Connection: Keep-Alive Content-Length: 0
- Cory_50405Noctilucent
This should work for you:
when HTTP_REQUEST { if { [string tolower [HTTP::host]] ends_with "mobilebank.com" } { HTTP::redirect "https://www.mobilebank.org" } }
- Cory_50405Noctilucent
Keep in mind though that if an HTTPS request arrives for mobilebank.com, you'll need to terminate the SSL in order for these iRules to do any redirection.