blob: cc1fbbd87cf9038ca7557e5d3b1ca36baca5b1ea [file] [log] [blame]
Willy Tarreaubaaee002006-06-26 02:48:02 +02001/*
Willy Tarreaudeb9ed82010-01-03 21:03:22 +01002 * include/common/defaults.h
3 * Miscellaneous default values.
4 *
5 * Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation, version 2.1
10 * exclusively.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
Willy Tarreaubaaee002006-06-26 02:48:02 +020021
Willy Tarreau2dd0d472006-06-29 17:53:05 +020022#ifndef _COMMON_DEFAULTS_H
23#define _COMMON_DEFAULTS_H
Willy Tarreaubaaee002006-06-26 02:48:02 +020024
Willy Tarreaubaaee002006-06-26 02:48:02 +020025/*
26 * BUFSIZE defines the size of a read and write buffer. It is the maximum
27 * amount of bytes which can be stored by the proxy for each session. However,
28 * when reading HTTP headers, the proxy needs some spare space to add or rewrite
29 * headers if needed. The size of this spare is defined with MAXREWRITE. So it
30 * is not possible to process headers longer than BUFSIZE-MAXREWRITE bytes. By
31 * default, BUFSIZE=16384 bytes and MAXREWRITE=BUFSIZE/2, so the maximum length
32 * of headers accepted is 8192 bytes, which is in line with Apache's limits.
33 */
34#ifndef BUFSIZE
35#define BUFSIZE 16384
36#endif
37
38// reserved buffer space for header rewriting
39#ifndef MAXREWRITE
40#define MAXREWRITE (BUFSIZE / 2)
41#endif
42
Willy Tarreaubf43f6e2013-06-03 15:52:52 +020043#ifndef REQURI_LEN
Willy Tarreaubaaee002006-06-26 02:48:02 +020044#define REQURI_LEN 1024
Willy Tarreaubf43f6e2013-06-03 15:52:52 +020045#endif
46
47#ifndef CAPTURE_LEN
Willy Tarreaubaaee002006-06-26 02:48:02 +020048#define CAPTURE_LEN 64
Willy Tarreaubf43f6e2013-06-03 15:52:52 +020049#endif
Willy Tarreaubaaee002006-06-26 02:48:02 +020050
Willy Tarreau4e957902014-06-27 18:08:49 +020051#ifndef MAX_SYSLOG_LEN
52#define MAX_SYSLOG_LEN 1024
53#endif
54
Krzysztof Piotr Oledzkie6bbd742007-11-01 00:33:12 +010055// maximum line size when parsing config
56#ifndef LINESIZE
57#define LINESIZE 2048
58#endif
59
Willy Tarreaubaaee002006-06-26 02:48:02 +020060// max # args on a configuration line
Krzysztof Piotr Oledzkie6bbd742007-11-01 00:33:12 +010061#define MAX_LINE_ARGS 64
Willy Tarreaubaaee002006-06-26 02:48:02 +020062
Willy Tarreau5ca791d2009-08-16 19:06:42 +020063// max # args on a stats socket
Willy Tarreau47060b62013-08-01 21:11:42 +020064// This should cover at least 5 + twice the # of data_types
65#define MAX_STATS_ARGS 64
Krzysztof Piotr Oledzki2c6962c2008-03-02 02:42:14 +010066
Willy Tarreaubaaee002006-06-26 02:48:02 +020067// max # of matches per regexp
68#define MAX_MATCH 10
69
Willy Tarreaue5f20dc2006-12-03 15:21:35 +010070// max # of headers in one HTTP request or response
Willy Tarreauac1932d2011-10-24 19:14:41 +020071// By default, about 100 headers (+1 for the first line)
Willy Tarreaue5f20dc2006-12-03 15:21:35 +010072#ifndef MAX_HTTP_HDR
Willy Tarreauac1932d2011-10-24 19:14:41 +020073#define MAX_HTTP_HDR 101
Willy Tarreaue5f20dc2006-12-03 15:21:35 +010074#endif
75
Willy Tarreaubce70882009-09-07 11:51:47 +020076// max # of headers in history when looking for header #-X
77#ifndef MAX_HDR_HISTORY
78#define MAX_HDR_HISTORY 10
79#endif
80
Willy Tarreaub4c84932013-07-23 19:15:30 +020081// max # of stick counters per session (at least 3 for sc0..sc2)
Willy Tarreaub4c84932013-07-23 19:15:30 +020082#ifndef MAX_SESS_STKCTR
83#define MAX_SESS_STKCTR 3
84#endif
85
Willy Tarreauedee1d62014-07-15 16:44:27 +020086// max # of extra stick-table data types that can be registred at runtime
87#ifndef STKTABLE_EXTRA_DATA_TYPES
88#define STKTABLE_EXTRA_DATA_TYPES 0
89#endif
90
Willy Tarreaub8949f12007-03-23 22:39:59 +010091// max # of loops we can perform around a read() which succeeds.
92// It's very frequent that the system returns a few TCP segments at a time.
93#ifndef MAX_READ_POLL_LOOPS
94#define MAX_READ_POLL_LOOPS 4
95#endif
96
Willy Tarreau6f4a82c2009-03-21 20:43:57 +010097// minimum number of bytes read at once above which we don't try to read
98// more, in order not to risk facing an EAGAIN. Most often, if we read
99// at least 10 kB, we can consider that the system has tried to read a
100// full buffer and got multiple segments (>1 MSS for jumbo frames, >7 MSS
101// for normal frames) did not bother truncating the last segment.
102#ifndef MIN_RECV_AT_ONCE_ENOUGH
103#define MIN_RECV_AT_ONCE_ENOUGH (7*1448)
104#endif
105
Willy Tarreau14acc702011-05-11 20:47:24 +0200106// The minimum number of bytes to be forwarded that is worth trying to splice.
107// Below 4kB, it's not worth allocating pipes nor pretending to zero-copy.
108#ifndef MIN_SPLICE_FORWARD
109#define MIN_SPLICE_FORWARD 4096
110#endif
111
Willy Tarreau1db37712007-06-03 17:16:49 +0200112// the max number of events returned in one call to poll/epoll. Too small a
113// value will cause lots of calls, and too high a value may cause high latency.
114#ifndef MAX_POLL_EVENTS
115#define MAX_POLL_EVENTS 200
116#endif
117
Willy Tarreaubaaee002006-06-26 02:48:02 +0200118// cookie delimitor in "prefix" mode. This character is inserted between the
119// persistence cookie and the original value. The '~' is allowed by RFC2965,
120// and should not be too common in server names.
121#ifndef COOKIE_DELIM
122#define COOKIE_DELIM '~'
123#endif
124
Willy Tarreaubca99692010-10-06 19:25:55 +0200125// this delimitor is used between a server's name and a last visit date in
126// cookies exchanged with the client.
127#ifndef COOKIE_DELIM_DATE
128#define COOKIE_DELIM_DATE '|'
129#endif
130
Willy Tarreaubaaee002006-06-26 02:48:02 +0200131#define CONN_RETRIES 3
132
133#define CHK_CONNTIME 2000
134#define DEF_CHKINTR 2000
135#define DEF_FALLTIME 3
136#define DEF_RISETIME 2
Simon Horman58c32972013-11-25 10:46:38 +0900137#define DEF_AGENT_FALLTIME 1
138#define DEF_AGENT_RISETIME 1
Willy Tarreaue9d87882010-01-27 11:28:42 +0100139#define DEF_CHECK_REQ "OPTIONS / HTTP/1.0\r\n"
Simon Horman98637e52014-06-20 12:30:16 +0900140#define DEF_CHECK_PATH ""
Willy Tarreau23677902007-05-08 23:50:35 +0200141#define DEF_SMTP_CHECK_REQ "HELO localhost\r\n"
Gabor Lekenyb4c81e42010-09-29 18:17:05 +0200142#define DEF_LDAP_CHECK_REQ "\x30\x0c\x02\x01\x01\x60\x07\x02\x01\x03\x04\x00\x80\x00"
Hervé COMMOWICKec032d62011-08-05 16:23:48 +0200143#define DEF_REDIS_CHECK_REQ "*1\r\n$4\r\nPING\r\n"
Willy Tarreaubaaee002006-06-26 02:48:02 +0200144
Krzysztof Piotr Oledzki97f07b82009-12-15 22:31:24 +0100145#define DEF_HANA_ONERR HANA_ONERR_FAILCHK
146#define DEF_HANA_ERRLIMIT 10
147
Ross Westaf72a1d2008-08-03 10:51:45 +0200148// X-Forwarded-For header default
149#define DEF_XFORWARDFOR_HDR "X-Forwarded-For"
150
Maik Broemme2850cb42009-04-17 18:53:21 +0200151// X-Original-To header default
152#define DEF_XORIGINALTO_HDR "X-Original-To"
153
Willy Tarreaubaaee002006-06-26 02:48:02 +0200154/* Default connections limit.
155 *
156 * A system limit can be enforced at build time in order to avoid using haproxy
157 * beyond reasonable system limits. For this, just define SYSTEM_MAXCONN to the
158 * absolute limit accepted by the system. If the configuration specifies a
159 * higher value, it will be capped to SYSTEM_MAXCONN and a warning will be
160 * emitted. The only way to override this limit will be to set it via the
161 * command-line '-n' argument.
162 */
163#ifndef SYSTEM_MAXCONN
Willy Tarreauc9fe4562009-06-15 16:33:36 +0200164#ifndef DEFAULT_MAXCONN
Willy Tarreaubaaee002006-06-26 02:48:02 +0200165#define DEFAULT_MAXCONN 2000
Willy Tarreauc9fe4562009-06-15 16:33:36 +0200166#endif
Willy Tarreaubaaee002006-06-26 02:48:02 +0200167#else
Willy Tarreauc9fe4562009-06-15 16:33:36 +0200168#undef DEFAULT_MAXCONN
Willy Tarreaubaaee002006-06-26 02:48:02 +0200169#define DEFAULT_MAXCONN SYSTEM_MAXCONN
170#endif
171
Willy Tarreau2c43a1e2007-10-14 23:05:39 +0200172/* Minimum check interval for spread health checks. Servers with intervals
173 * greater than or equal to this value will have their checks spread apart
174 * and will be considered when searching the minimal interval.
175 * Others will be ignored for the minimal interval and will have their checks
176 * scheduled on a different basis.
177 */
178#ifndef SRV_CHK_INTER_THRES
179#define SRV_CHK_INTER_THRES 1000
180#endif
181
Krzysztof Oledzkid9db9272007-10-15 10:05:11 +0200182/* Specifies the string used to report the version and release date on the
183 * statistics page. May be defined to the empty string ("") to permanently
184 * disable the feature.
185 */
186#ifndef STATS_VERSION_STRING
187#define STATS_VERSION_STRING " version " HAPROXY_VERSION ", released " HAPROXY_DATE
188#endif
189
Willy Tarreau8f38bd02009-05-10 08:53:33 +0200190/* Maximum signal queue size, and also number of different signals we can
191 * handle.
192 */
193#ifndef MAX_SIGNAL
194#define MAX_SIGNAL 256
195#endif
196
Willy Tarreau3ad6a762009-08-16 10:08:02 +0200197/* Maximum host name length */
198#ifndef MAX_HOSTNAME_LEN
199#define MAX_HOSTNAME_LEN 32
200#endif
201
Krzysztof Piotr Oledzkif7089f52009-10-10 21:06:49 +0200202/* Maximum health check description length */
203#ifndef HCHK_DESC_LEN
204#define HCHK_DESC_LEN 128
205#endif
206
Emeric Brun76d88952012-10-05 15:47:31 +0200207/* ciphers used as defaults on connect */
208#ifndef CONNECT_DEFAULT_CIPHERS
209#define CONNECT_DEFAULT_CIPHERS NULL
210#endif
211
212/* ciphers used as defaults on listeners */
213#ifndef LISTEN_DEFAULT_CIPHERS
214#define LISTEN_DEFAULT_CIPHERS NULL
215#endif
216
Emeric Brun6924ef82013-03-06 14:08:53 +0100217/* named curve used as defaults for ECDHE ciphers */
218#ifndef ECDHE_DEFAULT_CURVE
219#define ECDHE_DEFAULT_CURVE "prime256v1"
220#endif
221
Emeric Brun46635772012-11-14 11:32:56 +0100222/* ssl cache size */
223#ifndef SSLCACHESIZE
224#define SSLCACHESIZE 20000
225#endif
226
Remi Gacognef46cd6e2014-06-12 14:58:40 +0200227/* ssl max dh param size */
228#ifndef SSL_DEFAULT_DH_PARAM
229#define SSL_DEFAULT_DH_PARAM 0
230#endif
231
Willy Tarreau4bfc5802014-06-17 12:19:18 +0200232/* Number of samples used to compute the times reported in stats. A power of
233 * two is highly recommended, and this value multiplied by the largest response
234 * time must not overflow and unsigned int. See freq_ctr.h for more information.
235 * We consider that values are accurate to 95% with two batches of samples below,
236 * so in order to advertise accurate times across 1k samples, we effectively
237 * measure over 512.
238 */
239#ifndef TIME_STATS_SAMPLES
240#define TIME_STATS_SAMPLES 512
241#endif
242
Emeric Brun4147b2e2014-06-16 18:36:30 +0200243/* max ocsp cert id asn1 encoded length */
244#ifndef OCSP_MAX_CERTID_ASN1_LENGTH
245#define OCSP_MAX_CERTID_ASN1_LENGTH 128
246#endif
247
Emeric Brunc8b27b62014-06-19 14:16:17 +0200248#ifndef OCSP_MAX_RESPONSE_TIME_SKEW
249#define OCSP_MAX_RESPONSE_TIME_SKEW 300
250#endif
Willy Tarreau2dd0d472006-06-29 17:53:05 +0200251#endif /* _COMMON_DEFAULTS_H */