Forum Discussion
dacrud_18985
Nimbostratus
May 20, 2008redirect help
Hi all,
So this is the iRule I'm trying to create:
* redirect anything.domain.com to www.domain.com
* if anything.domain.com/us, first make it www.domain.com/us and then direct it to a certain pool
* if anything.domain.com/au, first make it www.domain.com/au and then direct it to a certain pool
I had a response to my post last week on the first step but I can't seem to figure out how to mix it with the last part. Not sure how you can redirect it but yet send it to different pools. Any help would be greatly appreciated.
5 Replies
- dacrud_18985
Nimbostratus
Will this work: - hoolio
Cirrostratus
Hi,when HTTP_REQUEST { Check if host isn't www.domain.com if {not ([string tolower [HTTP::host]] eq "www.domain.com")}{ log local0. "[IP::client_addr]:[TCP::client_port]: redirecting request from [HTTP::host][HTTP::uri] \ to http://www.domain.com[HTTP::uri]" Redirect to www.domain.com with the original URI appended HTTP::redirect http://www.domain.com[HTTP::uri] } else { Select the pool based on the start of the requested path switch -glob [HTTP::path] { "/us*" { Path started with /us, so use US pool pool US_pool log local0. "[IP::client_addr]:[TCP::client_port]: using pool US_pool" } "/au*" { Path started with /au, so use US pool pool AU_pool log local0. "[IP::client_addr]:[TCP::client_port]: using pool AU_pool" } default { Didn't match any of the above cases, so take some default action. pool default_pool log local0. "[IP::client_addr]:[TCP::client_port]: using default pool" } } } }
- dacrud_18985
Nimbostratus
Thanks for the help. - Andy_Herrman_22
Nimbostratus
So, for a request for anything.domain.com the iRule will effectively be run twice. - dacrud_18985
Nimbostratus
Yes thanks!
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