Hello, it is possible to resolve multiple URLs on your virtual server IP and perform HTTP-host-based load balancing.
Most common scenario will be https://portal1.mycompany.com and https://portal2.mycompany.com are both resolved with 1.2.3.4 IP address, which is a Virtual Server on F5. These would be two separate websites that need to be load balanced to two different web server farms (pools).
With an HTTP profile (and clientSSL too if it's encrypted), you can retrieve HTTP::host information and use it to send traffic to the appropriate server farm
You can achieve this with an LTM policy (recommended for performance), or with an iRule that looks like this
when HTTP_REQUEST {
set host [string tolower [HTTP::host]]
switch -glob $host {
portal1.mycompany.com { pool PORTAL1 }
portal2.mycompany.com { pool PORTAL2 }
default { reject }
}
}
EDIT:: if you instead neet path-based load balancing, you can achieve similar performance by scripting an iRule that retrieves HTTP::uri and performs path-based selection based on its bvalue (in this case, maybe "if" statements perform better thant "switch" statement since "switch" requires exact match while "if" has operators like starts_with or contains that might be more appropriate)
Virtual server configuration will be something like
ltm virtual /Common/multiple_portals_VS {
destination 1.2.3.4:443
ip-protocol tcp
profiles {
/Common/clientssl_wildcard.mycompany.com {
context clientside
}
/Common/serverssl {
context serverside
}
/Common/tcp { }
/Common/http { }
}
rules {
/Common/iRule_portal_selection
}
source 0.0.0.0/0
source-address-translation {
pool /Common/sNAT_Pool
type snat
}
translate-address enabled
translate-port enabled
vlans {
/Common/DMZ_External
}
vlans-enabled
}