* released 1.1.23
* fixed a stupid bug introduced in 1.1.22 which caused second and subsequent 'default' sections to keep previous parameters, and not initialize logs correctly. * fixed a second stupid bug introduced in 1.1.22 which caused configurations relying on 'dispatch' mode to segfault at the first connection. * 'option httpchk' now supports method, HTTP version and a few headers. * now, 'option httpchk', 'cookie' and 'capture' can be specified in 'defaults' section * a fresh new english documentation * large Makefile cleanup for increased portability * new build script 'build.cfg' for Formilux-0.1.8 * new startup script 'init.haproxy.flx0' for Formilux-0.1.8
This commit is contained in:
parent
a41a8b4ee6
commit
eedaa9f220
12
CHANGELOG
12
CHANGELOG
@ -1,7 +1,17 @@
|
|||||||
ChangeLog :
|
ChangeLog :
|
||||||
===========
|
===========
|
||||||
|
|
||||||
2003/09/10 :
|
2003/09/19 : 1.1.23
|
||||||
|
- fixed a stupid bug introduced in 1.1.22 which caused second and subsequent
|
||||||
|
'default' sections to keep previous parameters, and not initialize logs
|
||||||
|
correctly.
|
||||||
|
- fixed a second stupid bug introduced in 1.1.22 which caused configurations
|
||||||
|
relying on 'dispatch' mode to segfault at the first connection.
|
||||||
|
- 'option httpchk' now supports method, HTTP version and a few headers.
|
||||||
|
- now, 'option httpchk', 'cookie' and 'capture' can be specified in
|
||||||
|
'defaults' section
|
||||||
|
|
||||||
|
2003/09/10 : 1.1.22
|
||||||
- 'listen' now supports optionnal address:port-range lists
|
- 'listen' now supports optionnal address:port-range lists
|
||||||
- 'bind' introduced to add new listen addresses
|
- 'bind' introduced to add new listen addresses
|
||||||
- fixed a bug which caused a session to be kept established on a server till
|
- fixed a bug which caused a session to be kept established on a server till
|
||||||
|
49
Makefile
49
Makefile
@ -1,53 +1,72 @@
|
|||||||
|
# This makefile supports different OS and CPU setups.
|
||||||
|
# You should use it this way :
|
||||||
|
# make TARGET=os CPU=cpu
|
||||||
|
|
||||||
# Select target OS. TARGET must match a system for which COPTS and LIBS are
|
# Select target OS. TARGET must match a system for which COPTS and LIBS are
|
||||||
# correctly defined below.
|
# correctly defined below.
|
||||||
# You can set it on make's command line. eg: make TARGET=solaris
|
|
||||||
TARGET = linux24
|
TARGET = linux24
|
||||||
#TARGET = linux22
|
#TARGET = linux22
|
||||||
#TARGET = solaris
|
#TARGET = solaris
|
||||||
#TARGET = solarisv9
|
|
||||||
#TARGET = openbsd
|
#TARGET = openbsd
|
||||||
|
|
||||||
CC = gcc
|
# pass CPU=<cpu_name> to make to optimize for a particular CPU
|
||||||
LD = gcc
|
CPU = generic
|
||||||
|
#CPU = i586
|
||||||
|
#CPU = i686
|
||||||
|
#CPU = ultrasparc
|
||||||
|
|
||||||
# By default, we use libc's regex.
|
# By default, we use libc's regex.
|
||||||
REGEX=libc
|
REGEX=libc
|
||||||
#REGEX=pcre
|
#REGEX=pcre
|
||||||
|
|
||||||
|
# tools options
|
||||||
|
CC = gcc
|
||||||
|
LD = gcc
|
||||||
|
|
||||||
# This is the directory hosting include/pcre.h and lib/libpcre.* when REGEX=pcre
|
# This is the directory hosting include/pcre.h and lib/libpcre.* when REGEX=pcre
|
||||||
PCREDIR := $(shell pcre-config --prefix 2>/dev/null || :)
|
PCREDIR := $(shell pcre-config --prefix 2>/dev/null || :)
|
||||||
#PCREDIR=/usr/local
|
#PCREDIR=/usr/local
|
||||||
|
|
||||||
# This is for Linux 2.4 with netfilter
|
# This is for Linux 2.4 with netfilter
|
||||||
COPTS.linux24 = -O2 -DNETFILTER
|
COPTS.linux24 = -DNETFILTER
|
||||||
LIBS.linux24 =
|
LIBS.linux24 =
|
||||||
|
|
||||||
# This is for Linux 2.2
|
# This is for Linux 2.2
|
||||||
COPTS.linux22 = -O2 -DUSE_GETSOCKNAME
|
COPTS.linux22 = -DUSE_GETSOCKNAME
|
||||||
LIBS.linux22 =
|
LIBS.linux22 =
|
||||||
|
|
||||||
# This is for Solaris 8
|
# This is for Solaris 8
|
||||||
COPTS.solaris = -O2 -fomit-frame-pointer -DSOLARIS
|
COPTS.solaris = -fomit-frame-pointer -DSOLARIS
|
||||||
LIBS.solaris = -lnsl -lsocket
|
LIBS.solaris = -lnsl -lsocket
|
||||||
|
|
||||||
# This is for Solaris 8 on UltraSparc2 processor
|
|
||||||
COPTS.solarisv9 = -O6 -mcpu=v9 -mtune=ultrasparc -fomit-frame-pointer -DSOLARIS
|
|
||||||
LIBS.solarisv9 = -lnsl -lsocket
|
|
||||||
|
|
||||||
# This is for OpenBSD 3.0
|
# This is for OpenBSD 3.0
|
||||||
COPTS.openbsd = -O2
|
COPTS.openbsd =
|
||||||
LIBS.openbsd =
|
LIBS.openbsd =
|
||||||
|
|
||||||
COPTS.libc=
|
# CPU dependant optimizations
|
||||||
LIBS.libs=
|
COPTS.generic = -O2
|
||||||
|
COPTS.i586 = -O2 -march=i586
|
||||||
|
COPTS.i686 = -O2 -march=i686
|
||||||
|
COPTS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc
|
||||||
|
|
||||||
|
# options for standard regex library
|
||||||
|
COPTS.libc=
|
||||||
|
LIBS.libc=
|
||||||
|
|
||||||
|
# options for libpcre
|
||||||
COPTS.pcre=-DUSE_PCRE -I$(PCREDIR)/include
|
COPTS.pcre=-DUSE_PCRE -I$(PCREDIR)/include
|
||||||
LIBS.pcre=-L$(PCREDIR)/lib -lpcreposix -lpcre
|
LIBS.pcre=-L$(PCREDIR)/lib -lpcreposix -lpcre
|
||||||
|
|
||||||
|
# you can enable debug arguments with "DEBUG=-g" or disable them with "DEBUG="
|
||||||
#DEBUG =
|
#DEBUG =
|
||||||
DEBUG = -g
|
DEBUG = -g
|
||||||
|
|
||||||
COPTS=$(COPTS.$(TARGET)) $(COPTS.$(REGEX))
|
# global options
|
||||||
|
TARGET_OPTS=$(COPTS.$(TARGET))
|
||||||
|
REGEX_OPTS=$(COPTS.$(REGEX))
|
||||||
|
CPU_OPTS=$(COPTS.$(CPU))
|
||||||
|
|
||||||
|
COPTS=$(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS)
|
||||||
LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX))
|
LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX))
|
||||||
|
|
||||||
# - use -DSTATTIME=0 to disable statistics, else specify an interval in
|
# - use -DSTATTIME=0 to disable statistics, else specify an interval in
|
||||||
|
13
TODO
13
TODO
@ -73,11 +73,14 @@ ok>
|
|||||||
ok- les options
|
ok- les options
|
||||||
ok- le retry
|
ok- le retry
|
||||||
ok- les checks
|
ok- les checks
|
||||||
|
ok- les cookies/captures
|
||||||
- les options des serveurs ?
|
- les options des serveurs ?
|
||||||
- les filtres et regex ?
|
- les filtres et regex ?
|
||||||
- les cookies/captures
|
|
||||||
|
|
||||||
5) implémenter "balance source" pour faire un hash sur la source.
|
5) implémenter "balance source" pour faire un hash sur la source.
|
||||||
|
permettre de spécifier un masque sur lequel s'applique le hachage,
|
||||||
|
ainsi qu'une option pour hacher en fonction de l'adresse dans le
|
||||||
|
champ "x-forwarded-for".
|
||||||
|
|
||||||
6) possibilité d'un process séparé par listen :
|
6) possibilité d'un process séparé par listen :
|
||||||
listen XXX
|
listen XXX
|
||||||
@ -86,6 +89,9 @@ ok>
|
|||||||
le fait de spécifier group_id fera que toutes les instances utilisant le même
|
le fait de spécifier group_id fera que toutes les instances utilisant le même
|
||||||
identifiant de groupe seront gérées par un même processus.
|
identifiant de groupe seront gérées par un même processus.
|
||||||
|
|
||||||
|
-> plus souple et plus compréhensible de faire des sections par processus,
|
||||||
|
ce qui résoud également le cas ci-dessous
|
||||||
|
|
||||||
7) gérer un chroot/uid/gid différents par process :
|
7) gérer un chroot/uid/gid différents par process :
|
||||||
listen XXX
|
listen XXX
|
||||||
chroot /truc
|
chroot /truc
|
||||||
@ -100,3 +106,8 @@ identifiant de groupe seront g
|
|||||||
- alerte en cas de disparition
|
- alerte en cas de disparition
|
||||||
- le nombre max de sessions à lui envoyer
|
- le nombre max de sessions à lui envoyer
|
||||||
|
|
||||||
|
ok> 9) ajouter des paramètres optionnels à l'option "httpchk" permettant
|
||||||
|
ok> de forcer la méthode, la version HTTP et des headers.
|
||||||
|
ok> ex: option httpchk -> OPTIONS / HTTP/1.0
|
||||||
|
ok> option httpchk /test -> OPTIONS /test HTTP/1.0
|
||||||
|
ok> option httpchk HEAD / HTTP/1.0\nHost:\ www -> tel quel
|
||||||
|
1257
doc/haproxy-en.txt
Normal file
1257
doc/haproxy-en.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
H A - P r o x y
|
H A - P r o x y
|
||||||
---------------
|
---------------
|
||||||
version 1.1.22
|
version 1.1.23
|
||||||
willy tarreau
|
willy tarreau
|
||||||
2003/09/11
|
2003/09/20
|
||||||
|
|
||||||
================
|
================
|
||||||
| Introduction |
|
| Introduction |
|
||||||
@ -112,7 +112,7 @@ optionnel <niveau_max> d
|
|||||||
valeurs suivantes :
|
valeurs suivantes :
|
||||||
emerg, alert, crit, err, warning, notice, info, debug
|
emerg, alert, crit, err, warning, notice, info, debug
|
||||||
|
|
||||||
Par compatibilité avec les versions 1.1.16 et antérieures, La valeur par défaut
|
Par compatibilité avec les versions 1.1.16 et antérieures, la valeur par défaut
|
||||||
est "debug" si l'option n'est pas précisée.
|
est "debug" si l'option n'est pas précisée.
|
||||||
|
|
||||||
Les catégories possibles sont :
|
Les catégories possibles sont :
|
||||||
@ -138,12 +138,13 @@ param
|
|||||||
de sockets nécessaires, il faut prendre en compte ces paramètres :
|
de sockets nécessaires, il faut prendre en compte ces paramètres :
|
||||||
- 1 socket par connexion entrante
|
- 1 socket par connexion entrante
|
||||||
- 1 socket par connexion sortante
|
- 1 socket par connexion sortante
|
||||||
- 1 socket par proxy
|
- 1 socket par couple adresse/port d'écoute par proxy
|
||||||
- 1 socket pour chaque serveur en cours de health-check
|
- 1 socket pour chaque serveur en cours de health-check
|
||||||
- 1 socket pour les logs (tous serveurs confondus)
|
- 1 socket pour les logs (tous serveurs confondus)
|
||||||
|
|
||||||
Positionner la limite du nombre de descripteurs de fichiers (ulimit -n) à
|
Dans le cas où chaque proxy n'écoute que sur un couple adresse/port, positionner
|
||||||
2 * maxconn + nbproxy + nbserveurs + 1. Dans une future version, haproxy sera
|
la limite du nombre de descripteurs de fichiers (ulimit -n) à
|
||||||
|
(2 * maxconn + nbproxy + nbserveurs + 1). Dans une future version, haproxy sera
|
||||||
capable de positionner lui-même cette limite.
|
capable de positionner lui-même cette limite.
|
||||||
|
|
||||||
1.3) Diminution des privilèges
|
1.3) Diminution des privilèges
|
||||||
@ -165,13 +166,13 @@ processus utilisent les m
|
|||||||
Le paramètre 'chroot' autorise à changer la racine du processus une fois le
|
Le paramètre 'chroot' autorise à changer la racine du processus une fois le
|
||||||
programme lancé, de sorte que ni le processus, ni l'un de ses descendants ne
|
programme lancé, de sorte que ni le processus, ni l'un de ses descendants ne
|
||||||
puissent remonter de nouveau à la racine. Ce type de cloisonnement (chroot) est
|
puissent remonter de nouveau à la racine. Ce type de cloisonnement (chroot) est
|
||||||
parfois contournable sur certains OS (Linux 2.2, Solaris), mais visiblement
|
généralement contournable sur certains OS (Linux, Solaris) pour peu que
|
||||||
fiable sur d'autres (Linux 2.4). Aussi, il est important d'utiliser un
|
l'attaquant possède des droits 'root' et soit en mesure d'utiliser ou de créer
|
||||||
répertoire spécifique au service pour cet usage, et de ne pas mutualiser un même
|
un répertoire. Aussi, il est important d'utiliser un répertoire spécifique au
|
||||||
répertoire pour plusieurs services de nature différente. Pour rendre l'isolement
|
service pour cet usage, et de ne pas mutualiser un même répertoire pour
|
||||||
plus robuste, il est conseillé d'utiliser un répertoire vide, sans aucun droit,
|
plusieurs services de nature différente. Pour rendre l'isolement plus robuste,
|
||||||
et de changer l'uid du processus de sorte qu'il ne puisse rien faire dans ledit
|
il est conseillé d'utiliser un répertoire vide, sans aucun droit, et de changer
|
||||||
répertoire.
|
l'uid du processus de sorte qu'il ne puisse rien faire dans ledit répertoire.
|
||||||
|
|
||||||
Remarque: dans le cas où une telle faille serait mise en évidence, il est fort
|
Remarque: dans le cas où une telle faille serait mise en évidence, il est fort
|
||||||
probable que les premières tentatives de son exploitation provoquent un arrêt du
|
probable que les premières tentatives de son exploitation provoquent un arrêt du
|
||||||
@ -297,16 +298,20 @@ Exemples :
|
|||||||
|
|
||||||
2.1) Inhibition d'un service
|
2.1) Inhibition d'un service
|
||||||
----------------------------
|
----------------------------
|
||||||
Un serveur peut être désactivé pour des besoins de maintenance, sans avoir à
|
Un service peut être désactivé pour des besoins de maintenance, sans avoir à
|
||||||
commenter toute une partie du fichier. Il suffit de positionner le mot clé
|
commenter toute une partie du fichier. Il suffit de positionner le mot clé
|
||||||
"disabled" dans sa section :
|
"disabled" dans sa section :
|
||||||
|
|
||||||
listen smtp_proxy 0.0.0.0:25
|
listen smtp_proxy 0.0.0.0:25
|
||||||
disabled
|
disabled
|
||||||
|
|
||||||
|
Remarque: le mot clé 'enabled' permet de réactiver un service préalablement
|
||||||
|
désactivé par le mot clé 'disabled', par exemple à cause d'une
|
||||||
|
configuration par défaut.
|
||||||
|
|
||||||
2.2) Mode de fonctionnement
|
2.2) Mode de fonctionnement
|
||||||
---------------------------
|
---------------------------
|
||||||
Un serveur peut fonctionner dans trois modes différents :
|
Un service peut fonctionner dans trois modes différents :
|
||||||
- TCP
|
- TCP
|
||||||
- HTTP
|
- HTTP
|
||||||
- supervision
|
- supervision
|
||||||
@ -470,7 +475,7 @@ pour permettre aux serveurs de trouver le chemin de retour dans des contextes de
|
|||||||
routage difficiles. Si l'adresse est '0.0.0.0' ou '*' ou vide, elle sera choisie
|
routage difficiles. Si l'adresse est '0.0.0.0' ou '*' ou vide, elle sera choisie
|
||||||
librement par le systeme. Si le port est '0' ou vide, il sera choisi librement
|
librement par le systeme. Si le port est '0' ou vide, il sera choisi librement
|
||||||
par le système. Il est à noter que depuis la version 1.1.18, les tests de bon
|
par le système. Il est à noter que depuis la version 1.1.18, les tests de bon
|
||||||
foncitonnement des serveurs seront aussi effectués à partir de la source
|
fonctionnement des serveurs seront aussi effectués à partir de la source
|
||||||
spécifiée par ce paramètre.
|
spécifiée par ce paramètre.
|
||||||
|
|
||||||
Exemples :
|
Exemples :
|
||||||
@ -540,14 +545,17 @@ Remarques :
|
|||||||
- Il est possible de combiner 'insert' avec 'indirect' ou 'rewrite' pour s'adapter
|
- Il est possible de combiner 'insert' avec 'indirect' ou 'rewrite' pour s'adapter
|
||||||
à des applications générant déjà le cookie, avec un contenu invalide. Il suffit
|
à des applications générant déjà le cookie, avec un contenu invalide. Il suffit
|
||||||
pour cela de les spécifier sur la même ligne.
|
pour cela de les spécifier sur la même ligne.
|
||||||
|
|
||||||
- dans le cas où 'insert' et 'indirect' sont spécifiés, le cookie n'est jamais
|
- dans le cas où 'insert' et 'indirect' sont spécifiés, le cookie n'est jamais
|
||||||
transmis au serveur vu qu'il n'en a pas connaissance et ne pourrait pas le
|
transmis au serveur vu qu'il n'en a pas connaissance et ne pourrait pas le
|
||||||
comprendre.
|
comprendre.
|
||||||
|
|
||||||
- il est particulièrement recommandé d'utiliser 'nocache' en mode insertion si
|
- il est particulièrement recommandé d'utiliser 'nocache' en mode insertion si
|
||||||
des caches peuvent se trouver entre les clients et l'instance du proxy. Dans
|
des caches peuvent se trouver entre les clients et l'instance du proxy. Dans
|
||||||
le cas contraire, un cache HTTP 1.0 pourrait cacher la réponse, incluant le
|
le cas contraire, un cache HTTP 1.0 pourrait cacher la réponse, incluant le
|
||||||
cookie de persistence inséré, donc provoquer des changements de serveurs pour
|
cookie de persistence inséré, donc provoquer des changements de serveurs pour
|
||||||
des clients partageant le même cache.
|
des clients partageant le même cache.
|
||||||
|
|
||||||
- lorsque l'application est bien connue, et que les parties nécessitant de la
|
- lorsque l'application est bien connue, et que les parties nécessitant de la
|
||||||
persistence sont systématiquement accédées par un formulaire en mode POST,
|
persistence sont systématiquement accédées par un formulaire en mode POST,
|
||||||
il est plus efficace encore de combiner le mot clé "postonly" avec "insert"
|
il est plus efficace encore de combiner le mot clé "postonly" avec "insert"
|
||||||
@ -680,7 +688,12 @@ serveur. Seules les r
|
|||||||
compris non-réponses) aboutissent à un échec. Le temps maximal imparti pour une
|
compris non-réponses) aboutissent à un échec. Le temps maximal imparti pour une
|
||||||
réponse est égal à l'intervalle entre deux tests (paramètre "inter"). Pour
|
réponse est égal à l'intervalle entre deux tests (paramètre "inter"). Pour
|
||||||
activer ce mode, spécifier l'option "httpchk", éventuellement suivie d'une
|
activer ce mode, spécifier l'option "httpchk", éventuellement suivie d'une
|
||||||
URI. Voir les exemples ci-après.
|
méthode et d'une URI. L'option "httpchk" accepte donc 4 formes :
|
||||||
|
- option httpchk -> OPTIONS / HTTP/1.0
|
||||||
|
- option httpchk URI -> OPTIONS <URI> HTTP/1.0
|
||||||
|
- option httpchk METH URI -> <METH> <URI> HTTP/1.0
|
||||||
|
- option httpchk METH URI VER -> <METH> <URI> <VER>
|
||||||
|
Voir les exemples ci-après.
|
||||||
|
|
||||||
Depuis la version 1.1.17, il est possible de définir des serveurs de secours,
|
Depuis la version 1.1.17, il est possible de définir des serveurs de secours,
|
||||||
utilisés uniquement lorsqu'aucun des autres serveurs ne fonctionne. Pour cela,
|
utilisés uniquement lorsqu'aucun des autres serveurs ne fonctionne. Pour cela,
|
||||||
@ -735,6 +748,15 @@ Exemples :
|
|||||||
server web1 192.168.1.1:80 cookie server01 check
|
server web1 192.168.1.1:80 cookie server01 check
|
||||||
server web2 192.168.1.2:80 cookie server02 check inter 500 rise 1 fall 2
|
server web2 192.168.1.2:80 cookie server02 check inter 500 rise 1 fall 2
|
||||||
|
|
||||||
|
# idem avec surveillance HTTP par 'HEAD /index.jsp? HTTP/1.1\r\nHost: www'
|
||||||
|
listen http_proxy 0.0.0.0:80
|
||||||
|
mode http
|
||||||
|
cookie SERVERID
|
||||||
|
balance roundrobin
|
||||||
|
option httpchk HEAD /index.jsp? HTTP/1.1\r\nHost:\ www
|
||||||
|
server web1 192.168.1.1:80 cookie server01 check
|
||||||
|
server web2 192.168.1.2:80 cookie server02 check inter 500 rise 1 fall 2
|
||||||
|
|
||||||
# Insertion automatique de cookie dans la réponse du serveur, et suppression
|
# Insertion automatique de cookie dans la réponse du serveur, et suppression
|
||||||
# automatique dans la requête, tout en indiquant aux caches de ne pas garder
|
# automatique dans la requête, tout en indiquant aux caches de ne pas garder
|
||||||
# ce cookie.
|
# ce cookie.
|
||||||
@ -745,15 +767,15 @@ Exemples :
|
|||||||
server web1 192.168.1.1:80 cookie server01 check
|
server web1 192.168.1.1:80 cookie server01 check
|
||||||
server web2 192.168.1.2:80 cookie server02 check
|
server web2 192.168.1.2:80 cookie server02 check
|
||||||
|
|
||||||
# idem avec serveur applicatif de secours, et serveur de pages d'erreurs
|
# idem avec serveur applicatif de secours sur autre site, et serveur de pages d'erreurs
|
||||||
listen web_appl 0.0.0.0:80
|
listen web_appl 0.0.0.0:80
|
||||||
mode http
|
mode http
|
||||||
cookie SERVERID insert nocache indirect
|
cookie SERVERID insert nocache indirect
|
||||||
balance roundrobin
|
balance roundrobin
|
||||||
server web1 192.168.1.1:80 cookie server01 check
|
server web1 192.168.1.1:80 cookie server01 check
|
||||||
server web2 192.168.1.2:80 cookie server02 check
|
server web2 192.168.1.2:80 cookie server02 check
|
||||||
server web-backup 192.168.1.3:80 cookie server03 check backup
|
server web-backup 192.168.2.1:80 cookie server03 check backup
|
||||||
server web-excuse 192.168.1.4:80 check backup
|
server web-excuse 192.168.3.1:80 check backup
|
||||||
|
|
||||||
# relayage SMTP+TLS avec test du serveur et serveur de backup
|
# relayage SMTP+TLS avec test du serveur et serveur de backup
|
||||||
|
|
||||||
@ -1140,15 +1162,15 @@ dans une section 'defaults' :
|
|||||||
- enabled (pour faire l'opération inverse, mais c'est le cas par défaut)
|
- enabled (pour faire l'opération inverse, mais c'est le cas par défaut)
|
||||||
- contimeout, clitimeout, srvtimeout, grace, retries, maxconn
|
- contimeout, clitimeout, srvtimeout, grace, retries, maxconn
|
||||||
- option { redispatch, transparent, keepalive, forwardfor, httplog,
|
- option { redispatch, transparent, keepalive, forwardfor, httplog,
|
||||||
dontlognull, persist }
|
dontlognull, persist, httpchk }
|
||||||
- redispatch, redisp, transparent, source { addr:port }
|
- redispatch, redisp, transparent, source { addr:port }
|
||||||
|
|
||||||
Ne sont pas supportés dans cette version, d'une manière générale, tous les
|
|
||||||
paramètres qui nécessitent de mémoriser autre chose que des adresses IP uniques
|
|
||||||
et valeurs numériques simples :
|
|
||||||
- dispatch, server,
|
|
||||||
- cookie, capture
|
- cookie, capture
|
||||||
- errorloc
|
- errorloc
|
||||||
|
|
||||||
|
Ne sont pas supportés dans cette version, les adresses de dispatch et les
|
||||||
|
configurations de serveurs, ainsi que tous les filtres basés sur les
|
||||||
|
expressions régulières :
|
||||||
|
- dispatch, server,
|
||||||
- req*, rsp*,
|
- req*, rsp*,
|
||||||
|
|
||||||
Enfin, il n'y a pas le moyen, pour le moment, d'invalider un paramètre booléen
|
Enfin, il n'y a pas le moyen, pour le moment, d'invalider un paramètre booléen
|
||||||
|
25
examples/build.cfg
Normal file
25
examples/build.cfg
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# build script for formilux >0.1.8
|
||||||
|
|
||||||
|
PATCH_LIST=
|
||||||
|
FILE_LIST=
|
||||||
|
|
||||||
|
function do_compile_only {
|
||||||
|
$FLXMAKE CPU_OPTS="-march=$arch -mcpu=$cpu -Os -mpreferred-stack-boundary=2 -momit-leaf-frame-pointer -malign-jumps=0" \
|
||||||
|
TARGET=linux24
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_prepack {
|
||||||
|
mkdir -p $ROOTDIR/sbin/init.d ; cp examples/init.haproxy.flx0 $ROOTDIR/sbin/init.d/haproxy
|
||||||
|
mkdir -p $ROOTDIR/usr/sbin ; cp haproxy $ROOTDIR/usr/sbin
|
||||||
|
mkdir -p $ROOTDIR/usr/share/examples/$PKGRADIX/$PKGRADIX-$PKGVER/etc/haproxy/
|
||||||
|
cp examples/haproxy.cfg $ROOTDIR/usr/share/examples/$PKGRADIX/$PKGRADIX-$PKGVER/etc/haproxy/haproxy.cfg
|
||||||
|
cp examples/rc.highsock $ROOTDIR/usr/share/examples/$PKGRADIX/$PKGRADIX-$PKGVER/etc/rc.highsock
|
||||||
|
cp examples/config.rc.haproxy $ROOTDIR/usr/share/examples/$PKGRADIX/$PKGRADIX-$PKGVER/etc/config.rc.haproxy
|
||||||
|
mkdir -p $ROOTDIR/usr/share/$PKGRADIX/$PKGRADIX-$PKGVER
|
||||||
|
cp doc/haproxy.txt $ROOTDIR/usr/share/$PKGRADIX/$PKGRADIX-$PKGVER
|
||||||
|
ln -s ../../examples/$PKGRADIX/$PKGRADIX-$PKGVER $ROOTDIR/usr/share/$PKGRADIX/$PKGRADIX-$PKGVER/examples
|
||||||
|
cp examples/debug2ansi examples/debug2html examples/debugfind $ROOTDIR/usr/share/$PKGRADIX/$PKGRADIX-$PKGVER/
|
||||||
|
set_default_perm $ROOTDIR
|
||||||
|
}
|
@ -1,4 +1,3 @@
|
|||||||
service haproxy
|
service haproxy
|
||||||
config /etc/haproxy/haproxy.cfg
|
config /etc/haproxy/haproxy.cfg
|
||||||
maxconn 1024
|
|
||||||
|
|
||||||
|
20
examples/init.haproxy.flx0
Normal file
20
examples/init.haproxy.flx0
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. `dirname $0`/functions
|
||||||
|
|
||||||
|
option config standard_option /etc/haproxy/haproxy.cfg
|
||||||
|
option bin reserved_option /usr/sbin/haproxy
|
||||||
|
option cmdline reserved_option '$bin -q -D -f ${opt_config}'
|
||||||
|
|
||||||
|
function do_help {
|
||||||
|
echo "Usage: ${0##*/} <status|start|stop|help>"
|
||||||
|
echo "List of config.rc options (name, type, default value, current value) :"
|
||||||
|
echo
|
||||||
|
echo " - config ; def=/etc/haproxy/haproxy.cfg ; cur=$opt_confdir"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
load_config
|
||||||
|
|
136
haproxy.c
136
haproxy.c
@ -53,8 +53,8 @@
|
|||||||
#include <linux/netfilter_ipv4.h>
|
#include <linux/netfilter_ipv4.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAPROXY_VERSION "1.1.22"
|
#define HAPROXY_VERSION "1.1.23"
|
||||||
#define HAPROXY_DATE "2003/09/11"
|
#define HAPROXY_DATE "2003/09/20"
|
||||||
|
|
||||||
/* this is for libc5 for example */
|
/* this is for libc5 for example */
|
||||||
#ifndef TCP_NODELAY
|
#ifndef TCP_NODELAY
|
||||||
@ -1475,7 +1475,7 @@ int connect_server(struct session *s) {
|
|||||||
|
|
||||||
/* if this server remaps proxied ports, we'll use
|
/* if this server remaps proxied ports, we'll use
|
||||||
* the port the client connected to with an offset. */
|
* the port the client connected to with an offset. */
|
||||||
if (s->srv->state & SRV_MAPPORTS) {
|
if (s->srv != NULL && s->srv->state & SRV_MAPPORTS) {
|
||||||
struct sockaddr_in sockname;
|
struct sockaddr_in sockname;
|
||||||
int namelen;
|
int namelen;
|
||||||
|
|
||||||
@ -4405,6 +4405,48 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
curproxy->maxconn = defproxy.maxconn;
|
curproxy->maxconn = defproxy.maxconn;
|
||||||
curproxy->conn_retries = defproxy.conn_retries;
|
curproxy->conn_retries = defproxy.conn_retries;
|
||||||
curproxy->options = defproxy.options;
|
curproxy->options = defproxy.options;
|
||||||
|
|
||||||
|
if (defproxy.check_req)
|
||||||
|
curproxy->check_req = strdup(defproxy.check_req);
|
||||||
|
curproxy->check_len = defproxy.check_len;
|
||||||
|
|
||||||
|
if (defproxy.cookie_name)
|
||||||
|
curproxy->cookie_name = strdup(defproxy.cookie_name);
|
||||||
|
curproxy->cookie_len = defproxy.cookie_len;
|
||||||
|
|
||||||
|
if (defproxy.capture_name)
|
||||||
|
curproxy->capture_name = strdup(defproxy.capture_name);
|
||||||
|
curproxy->capture_namelen = defproxy.capture_namelen;
|
||||||
|
curproxy->capture_len = defproxy.capture_len;
|
||||||
|
|
||||||
|
if (defproxy.errmsg.msg400)
|
||||||
|
curproxy->errmsg.msg400 = strdup(defproxy.errmsg.msg400);
|
||||||
|
curproxy->errmsg.len400 = defproxy.errmsg.len400;
|
||||||
|
|
||||||
|
if (defproxy.errmsg.msg403)
|
||||||
|
curproxy->errmsg.msg403 = strdup(defproxy.errmsg.msg403);
|
||||||
|
curproxy->errmsg.len403 = defproxy.errmsg.len403;
|
||||||
|
|
||||||
|
if (defproxy.errmsg.msg408)
|
||||||
|
curproxy->errmsg.msg408 = strdup(defproxy.errmsg.msg408);
|
||||||
|
curproxy->errmsg.len408 = defproxy.errmsg.len408;
|
||||||
|
|
||||||
|
if (defproxy.errmsg.msg500)
|
||||||
|
curproxy->errmsg.msg500 = strdup(defproxy.errmsg.msg500);
|
||||||
|
curproxy->errmsg.len500 = defproxy.errmsg.len500;
|
||||||
|
|
||||||
|
if (defproxy.errmsg.msg502)
|
||||||
|
curproxy->errmsg.msg502 = strdup(defproxy.errmsg.msg502);
|
||||||
|
curproxy->errmsg.len502 = defproxy.errmsg.len502;
|
||||||
|
|
||||||
|
if (defproxy.errmsg.msg503)
|
||||||
|
curproxy->errmsg.msg503 = strdup(defproxy.errmsg.msg503);
|
||||||
|
curproxy->errmsg.len503 = defproxy.errmsg.len503;
|
||||||
|
|
||||||
|
if (defproxy.errmsg.msg504)
|
||||||
|
curproxy->errmsg.msg504 = strdup(defproxy.errmsg.msg504);
|
||||||
|
curproxy->errmsg.len504 = defproxy.errmsg.len504;
|
||||||
|
|
||||||
curproxy->clitimeout = defproxy.clitimeout;
|
curproxy->clitimeout = defproxy.clitimeout;
|
||||||
curproxy->contimeout = defproxy.contimeout;
|
curproxy->contimeout = defproxy.contimeout;
|
||||||
curproxy->srvtimeout = defproxy.srvtimeout;
|
curproxy->srvtimeout = defproxy.srvtimeout;
|
||||||
@ -4421,6 +4463,19 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (!strcmp(args[0], "defaults")) { /* use this one to assign default values */
|
else if (!strcmp(args[0], "defaults")) { /* use this one to assign default values */
|
||||||
|
/* some variables may have already been initialized earlier */
|
||||||
|
if (defproxy.check_req) free(defproxy.check_req);
|
||||||
|
if (defproxy.cookie_name) free(defproxy.cookie_name);
|
||||||
|
if (defproxy.capture_name) free(defproxy.capture_name);
|
||||||
|
if (defproxy.errmsg.msg400) free(defproxy.errmsg.msg400);
|
||||||
|
if (defproxy.errmsg.msg403) free(defproxy.errmsg.msg403);
|
||||||
|
if (defproxy.errmsg.msg408) free(defproxy.errmsg.msg408);
|
||||||
|
if (defproxy.errmsg.msg500) free(defproxy.errmsg.msg500);
|
||||||
|
if (defproxy.errmsg.msg502) free(defproxy.errmsg.msg502);
|
||||||
|
if (defproxy.errmsg.msg503) free(defproxy.errmsg.msg503);
|
||||||
|
if (defproxy.errmsg.msg504) free(defproxy.errmsg.msg504);
|
||||||
|
|
||||||
|
init_default_instance();
|
||||||
curproxy = &defproxy;
|
curproxy = &defproxy;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4460,15 +4515,16 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
}
|
}
|
||||||
else if (!strcmp(args[0], "cookie")) { /* cookie name */
|
else if (!strcmp(args[0], "cookie")) { /* cookie name */
|
||||||
int cur_arg;
|
int cur_arg;
|
||||||
if (curproxy == &defproxy) {
|
// if (curproxy == &defproxy) {
|
||||||
Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
|
// Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (curproxy->cookie_name != NULL) {
|
if (curproxy->cookie_name != NULL) {
|
||||||
Alert("parsing [%s:%d] : cookie name already specified. Continuing.\n",
|
// Alert("parsing [%s:%d] : cookie name already specified. Continuing.\n",
|
||||||
file, linenum);
|
// file, linenum);
|
||||||
return 0;
|
// return 0;
|
||||||
|
free(curproxy->cookie_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*(args[1]) == 0) {
|
if (*(args[1]) == 0) {
|
||||||
@ -4510,15 +4566,16 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(args[0], "capture")) { /* name of a cookie to capture */
|
else if (!strcmp(args[0], "capture")) { /* name of a cookie to capture */
|
||||||
if (curproxy == &defproxy) {
|
// if (curproxy == &defproxy) {
|
||||||
Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
|
// Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (curproxy->capture_name != NULL) {
|
if (curproxy->capture_name != NULL) {
|
||||||
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n",
|
// Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n",
|
||||||
file, linenum, args[0]);
|
// file, linenum, args[0]);
|
||||||
return 0;
|
// return 0;
|
||||||
|
free(curproxy->capture_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*(args[4]) == 0) {
|
if (*(args[4]) == 0) {
|
||||||
@ -4609,15 +4666,28 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
}
|
}
|
||||||
else if (!strcmp(args[1], "httpchk")) {
|
else if (!strcmp(args[1], "httpchk")) {
|
||||||
/* use HTTP request to check servers' health */
|
/* use HTTP request to check servers' health */
|
||||||
|
if (curproxy->check_req != NULL) {
|
||||||
|
free(curproxy->check_req);
|
||||||
|
}
|
||||||
curproxy->options |= PR_O_HTTP_CHK;
|
curproxy->options |= PR_O_HTTP_CHK;
|
||||||
if (*args[2]) {
|
if (!*args[2]) { /* no argument */
|
||||||
|
curproxy->check_req = strdup(DEF_CHECK_REQ); /* default request */
|
||||||
|
curproxy->check_len = strlen(DEF_CHECK_REQ);
|
||||||
|
} else if (!*args[3]) { /* one argument : URI */
|
||||||
int reqlen = strlen(args[2]) + strlen("OPTIONS / HTTP/1.0\r\n\r\n");
|
int reqlen = strlen(args[2]) + strlen("OPTIONS / HTTP/1.0\r\n\r\n");
|
||||||
curproxy->check_req = (char *)malloc(reqlen);
|
curproxy->check_req = (char *)malloc(reqlen);
|
||||||
curproxy->check_len = snprintf(curproxy->check_req, reqlen,
|
curproxy->check_len = snprintf(curproxy->check_req, reqlen,
|
||||||
"OPTIONS %s HTTP/1.0\r\n\r\n", args[2]); /* URI to use */
|
"OPTIONS %s HTTP/1.0\r\n\r\n", args[2]); /* URI to use */
|
||||||
} else {
|
} else { /* more arguments : METHOD URI [HTTP_VER] */
|
||||||
curproxy->check_req = strdup(DEF_CHECK_REQ); /* default request */
|
int reqlen = strlen(args[2]) + strlen(args[3]) + 3 + strlen("\r\n\r\n");
|
||||||
curproxy->check_len = strlen(DEF_CHECK_REQ);
|
if (*args[4])
|
||||||
|
reqlen += strlen(args[4]);
|
||||||
|
else
|
||||||
|
reqlen += strlen("HTTP/1.0");
|
||||||
|
|
||||||
|
curproxy->check_req = (char *)malloc(reqlen);
|
||||||
|
curproxy->check_len = snprintf(curproxy->check_req, reqlen,
|
||||||
|
"%s %s %s\r\n\r\n", args[2], args[3], *args[4]?args[4]:"HTTP/1.0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(args[1], "persist")) {
|
else if (!strcmp(args[1], "persist")) {
|
||||||
@ -5194,10 +5264,10 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
int errnum;
|
int errnum;
|
||||||
char *err;
|
char *err;
|
||||||
|
|
||||||
if (curproxy == &defproxy) {
|
// if (curproxy == &defproxy) {
|
||||||
Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
|
// Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (*(args[2]) == 0) {
|
if (*(args[2]) == 0) {
|
||||||
Alert("parsing [%s:%d] : <errorloc> expects <error> and <url> as arguments.\n", file, linenum);
|
Alert("parsing [%s:%d] : <errorloc> expects <error> and <url> as arguments.\n", file, linenum);
|
||||||
@ -5210,7 +5280,7 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
|
|
||||||
if (errnum == 400) {
|
if (errnum == 400) {
|
||||||
if (curproxy->errmsg.msg400) {
|
if (curproxy->errmsg.msg400) {
|
||||||
Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
//Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
||||||
free(curproxy->errmsg.msg400);
|
free(curproxy->errmsg.msg400);
|
||||||
}
|
}
|
||||||
curproxy->errmsg.msg400 = err;
|
curproxy->errmsg.msg400 = err;
|
||||||
@ -5218,7 +5288,7 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
}
|
}
|
||||||
else if (errnum == 403) {
|
else if (errnum == 403) {
|
||||||
if (curproxy->errmsg.msg403) {
|
if (curproxy->errmsg.msg403) {
|
||||||
Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
//Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
||||||
free(curproxy->errmsg.msg403);
|
free(curproxy->errmsg.msg403);
|
||||||
}
|
}
|
||||||
curproxy->errmsg.msg403 = err;
|
curproxy->errmsg.msg403 = err;
|
||||||
@ -5226,7 +5296,7 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
}
|
}
|
||||||
else if (errnum == 408) {
|
else if (errnum == 408) {
|
||||||
if (curproxy->errmsg.msg408) {
|
if (curproxy->errmsg.msg408) {
|
||||||
Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
//Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
||||||
free(curproxy->errmsg.msg408);
|
free(curproxy->errmsg.msg408);
|
||||||
}
|
}
|
||||||
curproxy->errmsg.msg408 = err;
|
curproxy->errmsg.msg408 = err;
|
||||||
@ -5234,7 +5304,7 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
}
|
}
|
||||||
else if (errnum == 500) {
|
else if (errnum == 500) {
|
||||||
if (curproxy->errmsg.msg500) {
|
if (curproxy->errmsg.msg500) {
|
||||||
Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
//Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
||||||
free(curproxy->errmsg.msg500);
|
free(curproxy->errmsg.msg500);
|
||||||
}
|
}
|
||||||
curproxy->errmsg.msg500 = err;
|
curproxy->errmsg.msg500 = err;
|
||||||
@ -5242,7 +5312,7 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
}
|
}
|
||||||
else if (errnum == 502) {
|
else if (errnum == 502) {
|
||||||
if (curproxy->errmsg.msg502) {
|
if (curproxy->errmsg.msg502) {
|
||||||
Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
//Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
||||||
free(curproxy->errmsg.msg502);
|
free(curproxy->errmsg.msg502);
|
||||||
}
|
}
|
||||||
curproxy->errmsg.msg502 = err;
|
curproxy->errmsg.msg502 = err;
|
||||||
@ -5250,7 +5320,7 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
}
|
}
|
||||||
else if (errnum == 503) {
|
else if (errnum == 503) {
|
||||||
if (curproxy->errmsg.msg503) {
|
if (curproxy->errmsg.msg503) {
|
||||||
Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
//Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
||||||
free(curproxy->errmsg.msg503);
|
free(curproxy->errmsg.msg503);
|
||||||
}
|
}
|
||||||
curproxy->errmsg.msg503 = err;
|
curproxy->errmsg.msg503 = err;
|
||||||
@ -5258,7 +5328,7 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
}
|
}
|
||||||
else if (errnum == 504) {
|
else if (errnum == 504) {
|
||||||
if (curproxy->errmsg.msg504) {
|
if (curproxy->errmsg.msg504) {
|
||||||
Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
//Warning("parsing [%s:%d] : error %d already defined.\n", file, linenum, errnum);
|
||||||
free(curproxy->errmsg.msg504);
|
free(curproxy->errmsg.msg504);
|
||||||
}
|
}
|
||||||
curproxy->errmsg.msg504 = err;
|
curproxy->errmsg.msg504 = err;
|
||||||
@ -5298,6 +5368,8 @@ int readcfgfile(char *file) {
|
|||||||
if ((f=fopen(file,"r")) == NULL)
|
if ((f=fopen(file,"r")) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
init_default_instance();
|
||||||
|
|
||||||
while (fgets(line = thisline, sizeof(thisline), f) != NULL) {
|
while (fgets(line = thisline, sizeof(thisline), f) != NULL) {
|
||||||
linenum++;
|
linenum++;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ listen appli3-relais 127.0.0.1:10000-10100#,192.64.19.22:3129
|
|||||||
#option httplog
|
#option httplog
|
||||||
#option dontlognull
|
#option dontlognull
|
||||||
#balance roundrobin
|
#balance roundrobin
|
||||||
server app1_0 127.0.0.2 check port 113 inter 100 rise 2 fall 5
|
server app1_0 127.0.0.1:+12000 check port 113 inter 100 rise 2 fall 5
|
||||||
# server app1_1 127.0.0.1:8000 check inter 100 rise 2 fall 5
|
# server app1_1 127.0.0.1:8000 check inter 100 rise 2 fall 5
|
||||||
#server app1_2 127.0.0.1:8001 check inter 100 rise 2 fall 5 backup
|
#server app1_2 127.0.0.1:8001 check inter 100 rise 2 fall 5 backup
|
||||||
#retries 1
|
#retries 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user