haproxy
HAProxy doesn’t start, can not bind UNIX socket [/run/haproxy/admin.sock]
Haproxy needs to write to /run/haproxy/admin.sock but it wont create the directory for you. Create the directory /run/haproxy/ first or set stats socket to a different path.
Handling OPTIONS request in nginx
I’m probably late, but I had the same problem, and found two solutions to it. First is tricking Nginx that a 405 status is actually a 200 OK and then proxy_pass it to your HAProxy like this: error_page 405 =200 @405; location @405 { root /; proxy_pass http://yourproxy:8080; } The second solution is just to … Read more
Can I split a large HAProxy config file into multiple smaller files?
Configuration files can’t be linked together from a configuration directive. However HAProxy can load multiple configuration files from its command line, using the -f switch multiple times: haproxy -f conf/http-defaults -f conf/http-listeners -f conf/tcp-defaults -f conf/tcp-listeners If you want to be flexible with the amount of config files you can even specify a directory like … Read more
HAProxy – URL Based routing with load balancing
You can segregate requests based on URL and load balance with a single HAProxy server. Your configuration will have something like this: frontend http acl app1 path_end -i /app1/123 #matches path ending with “/app/123” acl app2 path_end -i /app2/123 acl app3 path_end -i /app3/123 use_backend srvs_app1 if app1 use_backend srvs_app2 if app2 use_backend srvs_app3 if … Read more
HAProxy vs. Nginx
Haproxy is a “load balancer” it doesn’t know to serve files or dynamic content. nginx is a web server capable of many interesting things. if you only need to load balance + HA some third web server then haproxy is enough. if you need to implement some static content or some logic in routing of … Read more
HAProxy + WebSocket Disconnection
Upgrade to latest version of socket.io (0.6.8 -> npm install socket.io@0.6.8, which is patched to work with HAProxy) and download the latest version of HAProxy. Here is an example config file: global maxconn 4096 # Total Max Connections. This is dependent on ulimit nbproc 2 defaults mode http frontend all 0.0.0.0:80 timeout client 5000 default_backend … Read more
Difference between frontend/backend and listen in haproxy
All three are called “proxies.” A listen is a combined frontend and backend. A listen has an implicit default_backend of itself, but the frontend logic of a listen can use other backends and its backend section can be used by other frontends. Fundamentally it just keep configuration more compact for simple rules, but otherwise it’s … Read more
Haproxy in front of varnish or the other way round?
I built a similar setup a few years back for a busy web application (only I did it with Squid instead of Varnish), and it worked out well. I would recommend using your first setup (HAProxy -> Varnish) with two modifications: Add a secondary HAProxy server using keepalived and a shared virtual IP Use the … Read more