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