The Edge Load Balancer is actually a HAProxy and supports different ways of balancing traffic between servers. One of these is balancing HTTP requests by URI, the web address of the page, which is what we will be looking at in this article.
This type of balancing is used when you need to separate 'heavy' requests from the rest of the traffic and redirect them to a separate pool of servers.
Test infrastructure
To demonstrate this method of balancing, we have deployed three virtual machines in a separate vApp: web1, web2, web3.
In our case, web2 will handle heavy traffic, and web1 and web3 will handle all other traffic.
Temporary fw and dnat rules have been added for debugging and testing the web servers.
Firewall - Allow traffic to the external IP on ports 80 to 83.
NAT - each port is redirected to its own server
The nginx web server was used, and two additional pages, light.html and heavy.html, were added to the home page.
The virtual machine and web server configurations are identical.
The differences are the hostnames, internal IP addresses and the web pages themselves: the header shows the hostname of the web server for clarity.
Load Balancer configuration
Global Configuration
Enabling balancing
Application Profiles
Add the application profile to be used by the virtual server.
Service Monitoring
Add web server monitoring. This is not required, but allows you to monitor performance and only use 'live' pool servers.
Monitor or None will be selected in the next step.
Pools
Add two pools of servers: for "heavy" traffic and for all other traffic
Application Rules
Add a rule that will allow the balancer to distribute traffic into pools depending on URIs:
acl site_heavy path_beg -i /heavy
use_backend pool-web2 if site_heavy
Pages with /heavy addresses will be handed over to pool-web2 pool servers.
There can be more rules than the virtual server uses.
Virtual Servers
Add a virtual server. On the General tab, enable it and select the Application Profile, External IP Address, Protocol and Default Pool.
On the Advanced tab, select the previously defined Application Rules.
The result will be the following settings:
Checking
Homepage
Clicking on the light url
Click on the heavy-link
URI balancing now works, setup is complete.
You can find examples of the different rules in the official documentation.