Forum Discussion
Julio_Navarro
Cirrostratus
Mar 24, 2015Replace domain of the URL using a iRule
Hello;
I am looking for a way to replace the domain of the URL using a iRule, and then redirect the user to the result.
For example:
https://home.domain.com -> replace domain.com to mydomain.net -> redirect to https://home.mydomain.net
https://bike.domain.com -> replace domain.com to mydomain.net -> redirect to https://bike.mydomain.net
But this iRule must be use for multiple URL having having the domain "domain.com"
How I can do this?
Thank you
J
1 Reply
- nitass
Employee
is it something like this?
config [root@ve11b:Active:In Sync] config tmsh list ltm rule qux ltm rule qux { when HTTP_REQUEST { if { not ([HTTP::host] contains "mydomain.net") } { HTTP::redirect http://[string map {domain.com mydomain.net} [HTTP::host]][HTTP::uri] } } } test [root@ve11b:Active:In Sync] config curl -I http://home.domain.com/something HTTP/1.0 302 Found Location: http://home.mydomain.net/something Server: BigIP Connection: Keep-Alive Content-Length: 0 [root@ve11b:Active:In Sync] config curl -I http://bike.domain.com/something HTTP/1.0 302 Found Location: http://bike.mydomain.net/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