Forum Discussion
PCarroll_70972
Nimbostratus
Mar 22, 2007IRule Newbie needs help with simple redirection
Hello All,
I have two URLS that will point to the same Virtual Server IP address:
url.mydomain.com
url2.mydomain.com
I want traffic destined url.mydomain.com to go to "pool1" & traffic destined for url2.mydomain.com to go to "pool2".
What's the best IRule to accomplish this?
- JRahm
Admin
Assuming the requests are standard http, or you are terminating SSL on the LTM, this should work for you:when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "url.mydomain.com" } { pool pool1 } elseif { [string tolower [HTTP::host]] equals "url2.mydomain.com" } { pool pool2 } else { pool default_pool } }
- PCarroll_70972
Nimbostratus
Thank you very much. - JRahm
Admin
HTTP::host is the value supplied by the client in the host header. HTTP::uri is everything in the URL after the host. - PCarroll_70972
Nimbostratus
Thank you once again. - Marc_Bergeron_5
Nimbostratus
Can you explain to me how this would work with SSL termination? - Kirk_Bauer_1018
Nimbostratus
You can't do it with SSL, sorry. The SSL key exchange happens before the BIG-IP can see the Host header and thus the BIG-IP can't know which certificate to present to the client. So unless you want to use one certificate for both sites (which would cause browser warnings) then you are out of luck. The only option is if you can get a wildcard cert (for *.mydomain.com for example). This is a limitation of SSL, not the BIG-IP. - Marc_Bergeron_5
Nimbostratus
That's exactly what I was thinking... you can't know which cert to use until you see the packet headers, and you can't get the packet headers without the cert.
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