redirecting to different port based on URL
Hello,
Did a bit of searching on this before-hand to come up with what I've got, wanted to run it by you to see if it will hold water.
There are a large number of URLs, around 80, which share around 10 public IPs. The web servers themselves will listen on different ports for each URL.
So there is something like this, ssl certs will be tied to these VIPs
vip: 10.10.10.10:8010 (url aaa.com) pool: aaa-pool
vip: 10.10.10.10:8020 (url bbb.com) pool: bbb-pool
vip: 10.10.10.10:8030 (url ccc.com) pool: ccc-pool
aaa-pool members: serverA:8010, serverB:8010
bbb-pool members: serverA:8020, serverB:8020
ccc-pool members: serverA:8030, serverB:8030
Clients will hit the url on 80 and/or 443, the requirement is to redirect them to the proper port based on url. So I created the following:
vip: 10.10.10.10:80, iRule: redirect-80-to-8xxx
vip: 10.10.10.10:443, iRule: redirect-443-to-8xxx
iRule redirect-80-to-8xxx below:
when HTTP_REQUEST {
switch [HTTP::host] {
"aaa.com" {
HTTP::redirect http://[getfield [HTTP::host] ":" 1]:8010[HTTP::uri]
}
"bbb.com" {
HTTP::redirect http://[getfield [HTTP::host] ":" 1]:8020[HTTP::uri]
}
"ccc.com" {
HTTP::redirect http://[getfield [HTTP::host] ":" 1]:8030[HTTP::uri]
}
}
}
Is that syntax correct? To pick out the url, and then forward to the proper vip.
If this iRule for http and https were to get loaded up with 80 matches, would that have an adverse impact on the LB?
Edit: sorry for funky formatting there
Thanks!