Forum Discussion
Darren_Person_2
Nimbostratus
Nov 03, 2006iRule URL Rewrite for Multiple domains
Can someone explain how to approach this problem?
I have multiple domains that each need to 302 redirect back to their primary's:
For example,
i have:
www.test.com ...
Nov 03, 2006
You could use a class along with the matchclass command (look in the wiki for an example on that one). Or you could use a switch statement if you want all the domains within your iRule and not externalized in a class
when HTTP_REQUEST {
switch [HTTP::host] {
"www.test.com" -
"test.com" -
"www.xyz.com" -
"xyz.com" - {
HTTP::redirect "http://primary.com[HTTP::uri]"
}
}
}
Remove the "[HTTP::uri]" from the redirect if you don't want to carry on the original request with the redirect.
If you have many addresses, it might be simpler to add them all to a class and use the matchclass command to search the class for the given host.
-Joe
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