5.3. Default Settings
defaultsettings configure parameters that apply to all proxy subsections in a configuration (
listen). A typical
defaultsection may look like the following:
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
modespecifies the protocol for the HAProxy instance. Using the
httpmode connects source requests to real servers based on HTTP, ideal for load balancing web servers. For other applications, use the
logspecifies log address and
syslogfacilities to which log entries are written. The
globalvalue refers the HAProxy instance to whatever is specified in the
logparameter in the
option httplogenables logging of various values of an HTTP session, including HTTP requests, session status, connection numbers, source address, and connection timers among other values.
option dontlognulldisables 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.
retriesspecifies the number of times a real server will retry a connection request after failing to connect on the first try.
timeoutvalues 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 10sgives 10 seconds to wait for a complete HTTP request from a client.
queue 1msets 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 10sspecifies the number of seconds to wait for a successful connection to a server.
client 1mspecifies the amount of time (in minutes) a client can remain inactive (it neither accepts nor sends data).
server 1mspecifies the amount of time (in minutes) a server is given to accept or send data before timeout occurs.