Haproxy capability for multiple ports 80, 443 interfaces

I need to have both layer7 and layer4. Api, where I redirect, requests two 2 different backends. one backend for GET requests and one backend for PUT, GET, and DELETE requests. This is my first layer 7.

Layer layer4 for handling websites that process api requests. They just split.

Layer7 worked sequentially before adding layer4 to this section, that is, it just made our balancing balance for api. When I migrate sites with a layer4 interface, api requests, i.e. layer7, are sometimes lost, but not always.

As you can see, sometimes the request is lost, sometimes it works:

[richv@lb2 ~]$ curl api
curl: (52) Empty reply from server                   <-- this is not ok, http 503
[richv@lb2 ~]$ curl api
{"error_code":256,"error_message":"No Site specified"}  <-- this is ok, cause didnt give all the headers.

Front ends:

frontend layer7-http-listener
bind *:80
bind *:443 ssl crt /etc/httpd/certs/haproxy.pem
mode http
option      httpclose
option      httplog
option      forwardfor
option accept-invalid-http-request

frontend layer4-listener
bind *:80  transparent
bind *:443 transparent
bind *:3306
mode tcp
option      tcplog
+4
source share

Source: https://habr.com/ru/post/1599150/


All Articles