5.3. Default Settings
default settings configure parameters that apply to all proxy subsections in a configuration (
listen). A typical
default section may look like the following:
Any parameter configured in
proxy subsection (
listen) takes precedence over the parameter value in
defaults mode http log global option httplog option dontlognull retries 3 timeout http-request 10s timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m
mode specifies the protocol for the HAProxy instance. Using the
http mode connects source requests to real servers based on HTTP, ideal for load balancing web servers. For other applications, use the
log specifies log address and
syslog facilities to which log entries are written. The
global value refers the HAProxy instance to whatever is specified in the
log parameter in the
option httplog enables logging of various values of an HTTP session, including HTTP requests, session status, connection numbers, source address, and connection timers among other values.
option dontlognull disables logging of null connections, meaning that HAProxy will not log connections wherein no data has been transferred. This is not recommended for environments such as web applications over the Internet where null connections could indicate malicious activities such as open port-scanning for vulnerabilities.
retries specifies the number of times a real server will retry a connection request after failing to connect on the first try.
timeout values specify the length of time of inactivity for a given request, connection, or response. These values are generally expressed in milliseconds (unless explicitly stated otherwise) but may be expressed in any other unit by suffixing the unit to the numeric value. Supported units are us (microseconds), ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days).
http-request 10s gives 10 seconds to wait for a complete HTTP request from a client.
queue 1m sets one minute as the amount of time to wait before a connection is dropped and a client receives a 503 or "Service Unavailable" error.
connect 10s specifies the number of seconds to wait for a successful connection to a server.
client 1m specifies the amount of time (in minutes) a client can remain inactive (it neither accepts nor sends data).
server 1m specifies the amount of time (in minutes) a server is given to accept or send data before timeout occurs.