New answers tagged

2

No, this is not possible. Haproxy does not understand the FTP protocol, and therefore can't do things like re-write the FTP commands and responses that include the true IP address of the FTP server. If that's a requirement, then you'll have to find a different proxy solution.


0

Is there any way to get HAproxy serving server-side generated 503 page instead of the default blank/unavailable page? This isn't the actual question you should be asking. HAProxy always uses the server's response. The error file is only used for errors generated internally by HAProxy. If you check your web server logs, you'll find that these specific ...


0

The problem is that the config does not handle HTTP 1.1 requests at all. You have to define a new backend block for HTTP1.1 requests. Since my servers are powered by nginx, I made it in this way: listen 9999 default_server; listen 9998 default_server http2; This is how my backend looks like: backend nodes-http2 mode tcp option tcplog server ...


0

Yes. Use the errorfile directive, for example via: errorfile 503 /etc/haproxy/errors/503.http The syntax is as follows: errorfile <code> <file> Quoting the docs: <code> is the HTTP status code. Currently, HAProxy is capable of generating codes 200, 400, 403, 405, 408, 429, 500, 502, 503, and 504. <file> ...


2

You cannot add a path on the server line like that, you will want to use a redirect in your listen block above the server lines: redirect location /app if { url / } and convert your server lines to server app01 10.0.0.2:8080 check See http://cbonte.github.io/haproxy-dconv/1.6/configuration.html#redirect for further explanation/examples, and note that ...


1

You have configured HAProxy to connect to 10.10.104.41 port 1038. The error message tells that it is unable to connect to this port. The reason could be one of these: The app server at that IP / Port is not started. The firewall on that server is not allowing external connections. There is no route to the IP of the app server. The app server IP / Port is ...


0

You need to have health checks in place https://www.haproxy.com/doc/aloha/7.0/haproxy/healthchecks.html. You specifically need check_timeouts "timeout check : time let to the server to answer the check. If both inter and timeout check are set, then the smallest value of both of them is used, after the TCP connection is established"


5

From official documentation of Haproxy 1.6: " The load balancing algorithm of a backend is set to roundrobin when no other algorithm, mode nor option have been set. The algorithm may only be set once for each backend." Refer this link for details : https://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4-balance


2

You could add something like the following to your config: listen stats bind ${PRIVATE_IP}:${PORT} stats enable stats uri /stats stats auth admin:admin I'm assuming the following points: You don't want to expose your stats to the public. If this is not the case, just move your stats into your existing frontend directive. Substitute ${...


2

Not sure which way most of your traffic flows, if it's client -> server, or server -> client, but if it's the later, you might be interested in using (or checking out, at least) the Linux Virtual Server (LVS) which is an advanced load balancing solution that can be used to build highly scalable and highly available network services, such as ...


1

In terms of software - haproxy is good, proven solution. You have several ways how to achieve correct load balancing. IP Hash balancing Depending on your source IP, destination server will be calculated using hash of source ip. Therefore all requests from one IP will always reach the same server (unless it is down). I use this option on projects, which ...


1

If some long-lived sessions are mixed with short-lived sessions (eg: WebSocket and HTTP), it's worth considering timeout tunnel, which overrides timeout client and timeout server for tunnels, as well as timeout client-fin for half-closed connections. http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#4.2-timeout%20client When timeout ...


4

As far as I know HAproxy does not have anything similar to apache's Include & IncludeOptional directives. There is no native support for multiple configuration files other than starting HAproxy with repeated -f <config-file> command line switches. see this thread. You can script something though to merge multiple subsections into a larger file ...


3

To answer my own question, this does not seem possible, as the traffic 'leaves' HAProxy here: TCP HTTP frontend->backend (->leaving->) frontend->backend So the context is lost and the capture cannot be preserved. Instead, as "PiBa-NL" suggested on IRC at #haproxy on Freenode yesterday: [5:29pm] PiBa-NL: kvz, ...


1

As I thought, small mistakes were in place for keepalived config file. state MASTER for 192.168.50.11 # This is the master HAProxy state BACKUP for 192.168.50.12 # This is the failover HAProxy And priority 12 for 192.168.50.11 # the higher priority goes with the master HAProxy priority 11 for 192.168.50.12


0

HAProxy should already be adding the X-Forwarded-For header. You may want to add protocol and/or port if either of these is non-standard. I usually test this sort of behavior with a page that echos the request headers. That makes it easy to see what headers are available, and what their contents are. It is not unusual for X-Forward-For to contain a ...


4

The trick is to set an environment flag for certain requests with the SetEnvIf directive and then instruct Apache to not log requests matching that: SetEnvIf Request_URI \.gif do-not-log-this-request SetEnvIf Remote_Addr "192\.168\.50\.11" do-not-log-this-request SetEnvIf Request_Method OPTIONS do-not-log-this-request CustomLog logs/access_log common env=!...


2

Transparent mode requires that the haproxy be the default gateway of the backend servers. Remote servers won't work.


0

Yes, the way you have things configured will essentially load balance all incoming connections between the backend servers. What you want is basically one backend definition for each real web server. I think the gist of what you want is multiple backend definitions, one for each real web server. Then in your frontend section, you'd want to use various ...


0

Well, it was vey simple: the HAProxy server was listening on the port 8080. So, the URL was http://server.company.cxx:8080/. Therefore, the host name was server.company.cxx:8080, including the port number as part of the hostname. This fixed the problem: frontend public bind :8080 acl is_company_server hdr(host) -i server.company.cxx:8080


1

Just tried @System's solution and it seems that the header name was changed from HTTP_X_FORWARDED_FOR to x-forwarded-for. Probably it's related with HAproxy version, 'cause the answer was written 5 years ago...? As an example, this is working on production: String requestIp = httpRequest.getHeader("x-forwarded-for");


2

From my understanding of what you're asking, you have control over all the steps of this process and want to bring up new versions of a containerized application which sit behind HAProxy without interrupting client connections to the old applications, but preventing new connections. This seems like a good use of the HAProxy disable server command. You ...


0

Updated config, since some values are deprecated capture request header X-Request-UID len 500 #Generate the X-Haproxy-Unique-ID and log it to make it easy to track requests log-format %ci:%cp\ [id=%ID]\ [%t]\ %f\ %b/%s\ %Tq/%Tw/%Tc/%Tr/%Tt\ %ST\ %B\ %CC\ %CS\ %tsc\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq\ {%hrl}\ {%hsl}\ %{+Q}r unique-id-...


0

you can achieve that using the unix socket commands. Take a look at point 9.2 of the management.txt doc file. There are third party tools that use this 'api' like haproxyctl, but I do not have any experience with them.


2

The nbsrv(<back-end>) internal state fetch can be used to evaluate whether the MySQL Server is alive, just as you are using it now to count available servers in the main group. The simplest solution is to create a dummy back-end with no servers. backend dead-end Then, in the front-end config, set the following before any other use_backend ...



Top 50 recent answers are included