HAProxy ACL for Load Balancing on URL Request
Until today I was using the basic HAProxy settings, Today i found a task about selection of backend server basis of url request. While working on this task, I learned about HAProxy ACLs.
Here is a quick example of uses url_beg ACL:
I hope this tutorial will help you to configure some basic ACL with haproxy .Regarding full configuration settings available for the ACL are listed in the haproxy configuration doc,
Task: I have wordpress installed as http://domainname.com/blog . This domain is running from 2 backend server and balanced by HAProxy, The task is to redirect all /blog requrest to only single server.Network Scenario for this setup
- HAProxy Server: 192.168.1.90
- WEB1 : 192.168.1.103
- WEB2 : 192.168.1.105
- Domain: tecadmin.net
Here is a quick example of uses url_beg ACL:
global log 127.0.0.1 local0 notice maxconn 50000 daemon defaults log global mode http option httplog option dontlognull contimeout 120000 clitimeout 120000 srvtimeout 120000 option forwardfor option http-server-close # Configuration for HTTP site frontend http-in bind 192.168.1.90:80 acl is_blog url_beg /blog use_backend tecadmin_blog if is_blog default_backend tecadmin_website backend tecadmin_blog mode http balance roundrobin # Load Balancing algorithm option httpchk option forwardfor server WEB2 192.168.1.105:80 weight 1 maxconn 512 check backend tecadmin_website mode http balance roundrobin # Load Balancing algorithm option httpchk option forwardfor server WEB1 192.168.1.103:80 weight 1 maxconn 512 check server WEB2 192.168.1.105:80 weight 1 maxconn 512 check
I hope this tutorial will help you to configure some basic ACL with haproxy .Regarding full configuration settings available for the ACL are listed in the haproxy configuration doc,
Nhận xét
Đăng nhận xét