Forum Discussion
Michael_-_Harr1
Nimbostratus
May 29, 2014REDIRECT IRULE need some help
I need help configuring a IRULE to redirect .com traffic to .org wether it is http or https
http:\mobilebank.com https:\www.mobilebank.org https:\mobilebank.com https:\www.mobilebank.org
3 Replies
- nitass
Employee
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_50405
Noctilucent
This should work for you:
when HTTP_REQUEST { if { [string tolower [HTTP::host]] ends_with "mobilebank.com" } { HTTP::redirect "https://www.mobilebank.org" } } - Cory_50405
Noctilucent
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.
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