A cheating Guide for HA Proxy !
apt install --no-install-recommends software-properties-common
add-apt-repository ppa:vbernat/haproxy-2.8 -y
It is the latest LTS Versionsudo apt install haproxy=2.4.\*
Maintain Future Upgrades
/etc/haproxy/haproxy.cfg
use HTTP Mode if you want to:
option forwardfor if-none
option forwardfor if-none
http-request set-header Forwarded for=%[src]
stats enable
to defaults section to enable it/haproxy?stats
of the target frontendFetch methods and What they do
acl iswest url_param(region) -i -m str west
Exact match http://mysite.com/?region=west
and -i
means case-insensitiveacl iswest url_param(region) -i -m str west westcoast wc
acl iswest url_param(west) -m reg .+
acl ismobile req.hdr(User-Agent) -i -m reg (android|iphone)
Filter the Mobile User-Agents and use a seperate backend for them. reg says contains android or iphoneacl ischeapshoes req.hdr(Host) -i -m str www.cheapshoes.com
, acl isexpensiveshoes req.hdr(Host) -i -m str www.expensiveshoes.com
acl ischeapshoes req.hdr(Host) -i -m str cheapshoes.com www.cheapshoes.com
req.hdr(<Header_Name>)
can get a header with its nameredirect prefix
302 The current request should be forwarded to the new URL. Future requests should use the original URL.
303 The current request should be forwarded to the new URL, but as a GET. For example, if a client sends a POST request to a form that submits a shopping cart, they could be redirected to another page that shows details of the purchase, but using a GET request. This page can be bookmarked, refreshed, etc. without resubmitting the form. This is available in HTTP/1.1.
307 The current request should be forwarded to the new URL, but do not change the HTTP verb used. For example, if POST was used before, use POST again. Future requests should use the original URL. This is available in HTTP/1.1.
308 The current and all future requests should use the new URL. Do not change the HTTP verb used. For example, if POST was used before, use POST again. This is available in HTTP/1.1.
```