02-Nov-2022 18:57
I am trying to take 443 traffic and redirect to two different URLs and (probably) 2 different pools.
I don't know if I need (or can have) 2 different VIPs for the same base website name.
I have https://somename.mycompany.com and I need to forward/redirect to https://somename.mycompany.com/site1 AND https://somename.mycompany.com/site1...site1 is not on the same server as site2....it would be separ...
Help?
02-Nov-2022 21:05
@jamie_staplesHow are you making the determination that a request for https://somename.mycompany.com shoud go to /site1 or /site2? Typically what happens is the following.
Client1 requests https://site1.mycompany.com/ then you direct that to the site1 pool.
Client2 requests https://site2.mycompany.com/ then you direct that to the site2 pool
13-Sep-2023 14:48
In an ideal world, what you have suggested would have been my preferred solution. It isn't, so I have to "reverse engineer" to get what the application wants. Thank you for your suggestion.
03-Nov-2022 03:03
Hello ,
>> I see you want to add a /path , so Try this iRule For redirection :
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] eq "host1") and ([string tolower [HTTP::uri]] eq "/path1") } {
HTTP::redirect "http://host1/path2"
} elseif { ([string tolower [HTTP::host]] eq "host2") and ([string tolower [HTTP::uri]] eq "/path3") } {
HTTP::redirect "http://host3/path4"
}
}
>> For Pool selection , you can add pool Action selection after each Redirection selection "HTTP::redirect "http://host1/path2" .
Or you can create another iRule for Pool Selection and attach it to the same Virtual server.
13-Sep-2023 15:57
This looks a lot like my current conundrum...I will test it out and let you know if I have any luck.
Thanks!
03-Nov-2022 04:49 - edited 03-Nov-2022 04:54
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
}
13-Sep-2023 14:50
I wish this were the case...unfortunately, it isn't...but thank you kindly for your detailed suggestion.