Portál AbcLinuxu, 11. prosince 2025 11:40
option forwardfor
do front/backend sekcie v haproxy configu vyriesi tvoje problemy, a web server bude vidiet IPcku klienta a nie haproxy. Samozrejme musis pouzit mod_rpaf ako pisal iwk.
# this config needs haproxy-1.1.28 or haproxy-1.2.1
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
user haproxy
group haproxy
daemon
tune.bufsize 65536 # Zvetsena header buffer size pro narocne requesty
defaults
log global
mode http
#option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 50000
clitimeout 50000
srvtimeout 600000
############
# FRONTEND #
############
frontend haproxy-frontend
bind a.b.c.d:80 # Default IP (novy rozsah)
default_backend haproxy-backend
###########
# BACKEND #
###########
backend haproxy-backend
mode http
balance roundrobin
stats enable
stats auth root:haproxy
stats hide-version
cookie JSESSIONID prefix
option httplog
option httpclose
option forwardfor
option httpchk HEAD /check.txt HTTP/1.0
option httpchk HEAD /check-load.php HTTP/1.0
server www-A 192.168.1.100:80 cookie A maxconn 100 weight 50 check
server www-B 192.168.1.101:80 cookie B maxconn 100 weight 50 check
server www-C 192.168.1.102:80 cookie C maxconn 100 weight 33 check backup
#################
# Custom errors #
#################
errorfile 503 /etc/haproxy/errors/503.http
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 504 /etc/haproxy/errors/504.http
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.