Forum Discussion
F5 TO LOAD BALANCE TWO DIFFRENT URL'S RUNNING ON THE SAME PORT (URGENT)
How can F5 be configured to load balance two different applications (url's) running on the same server and port.
Almost all scenarios i have seen include have had at least, different ports running both url's.
initially, i thought they were running on separate ports,and configured, http and https redirection for the actual url.e.g, https://smartit.networkershome.com/ux/myitapp/ using an irule like this,
HTTPS REDIRECTION.
when HTTP_REQUEST { if { [HTTP::host] equals "smartit.networkershome.com" && [HTTP::uri] equals "/"} { HTTP::redirect "https://smartit.networkershome.com/ux/smart-it";; } }
and HTTP REDIRECT FOR SAME VS ON PORT 80
when HTTP_REQUEST { if {[HTTP::host] equals "smartit.networkershome.com" } { HTTP::redirect "https://smartit.networkershome.com/ux/smart-it"; } }
And,both redirections are working well for the first url.
However,i deployed the same set of irules for the second url https://myit.networkershome.com/ux/myitapp/ (BOTH HTTPS,HTTP VIRTUAL SERVERS), and none is working.
I requested that the applications guys run the instances on different ports, but they insisted that the Tomcat engine could run both instances on the same port.
Both url's can be seen to work,if one loads in their exact url, but http,and https redirection for both at the same time,just isn't working.
I will be glad to get some help
2 Replies
- Ryannnnnnnnn
Altocumulus
Hi,
If vhosting is configured correctly on Tomcat then this should be a no-brainer.
Can you provide your virtual server configuration, or share how you have things configured?
Hi Kazeem,
you can host multiple ports (e.g. HTTP:80/HTTPS:443) on a single virtual server. But it will increase the complexity to a great extent (e.g. enabling/disabling SSL and conditinal redirecting if the request was send to TCP:80/TCP:443).
You may take a look to the iRules below to see the differences if you use a single combined Virtual Server in contrast to using two dedicated Virtual Servers.
iRule: Combined HTTP/HTTPS Virtual
when CLIENT_ACCEPTED { Handle to check the used port if { [TCP::local_port] == 80 } then { Handle for HTTP:80 requests (disable SSL profile) SSL::disable clientside set is_http 1 } else { Handle for HTTPS:443 requests (enable SSL profile ) SSL::enable clientside set is_http 0 } } when HTTP_REQUEST { Handle to apply different rulsets based on the Virtual Portnumber if { $is_http } then { Handle for SSL:443 requests if { [HTTP::host] equals "smartit.networkershome.com" } then { Handle for request to http://smartit.networkershome.com HTTP::redirect "https://smartit.networkershome.com/ux/smart-it" } else { Handle for request to different HOSTNAMES } } else { Handle for SSL:443 requests if { [HTTP::host] equals "smartit.networkershome.com" } then { Handle for request to https://smartit.networkershome.com if { [HTTP::uri] equals "/" } then { Handle for request to https://smartit.networkershome.com/ HTTP::redirect "/ux/smart-it" } else { Handle for request to https://smartit.networkershome.com/* } } else { Handle for request to different HOSTNAMES } } }A much easier approach would be to use dedicated Virtual Server for HTTP:80 and HTTP:443 access. In this case each virtual server will have fixed and appropiate SSL settings and have a tailordered iRule / LTM in place to supports the scenario.
iRule: Dedicated HTTP Virtual
when HTTP_REQUEST { if { [HTTP::host] equals "smartit.networkershome.com" } then { Handle for request to http://smartit.networkershome.com HTTP::redirect "https://smartit.networkershome.com/ux/smart-it" } else { Handle for request to different HOSTNAMES } }iRule: Dedicated HTTPS Virtual
when HTTP_REQUEST { if { [HTTP::host] equals "smartit.networkershome.com" } then { Handle for request to https://smartit.networkershome.com if { [HTTP::uri] equals "/" } then { Handle for request to https://smartit.networkershome.com/ HTTP::redirect "/ux/smart-it" } else { Handle for request to https://smartit.networkershome.com/* } } else { Handle for request to different HOSTNAMES } }Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
