Redirect traffic to specific nodes based on URI with non-standard port
We are trying to send all traffic containing a two specific URIs to two specific nodes (with non-default port numbers) in a single pool, while all other requests are directed to two other nodes in the same pool (on port 80). I've tried different combinations of redirections and iRules to accomplish this but have had no luck thus far. I've managed to get the redirection to work with a separate pool, but the webserver does not return the expected results.
There are two separate services running on a single server (80 and 8080). SSL is offloaded on the VIP and back-end traffic is unencrypted. I've tried different combinations of iRules, creating separate pools, and even separate VIPs, but have had no success.
My thought was to combine the nodes into the same pool and create an iRule that selectively load-balances the traffic to specific pool members based on the incomming URI.
From an iRule standpoint I'm assuming this would be a good start, but I'm not sure where to go from here. Forgive my syntax errors. I have never constructed iRules this complex before:
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
if { ((($uri starts_with "/X") or ($uri starts_with "/Y"))
HTTP::redirect http://[getfield [HTTP::host]":" 1]:8080[@uri])
}
{
node 10.x.x.x:8080
node 10.X.X.X:8080
}
else .... send to other nodes on 80
}
The process looks something like this:
1.) If the incomming URI starts with "/X" or "/Y"
a. Make sure to include ":8080" after the FQDN while maintaining the original URI
b. Forward the traffic to two specific pool members
2.) Otherwise...
a. Forward all other requests to the other two separate pool members
b. Don't worry about :8080
Any ideas?