HAproxy allows backend RS to record real IP addresses
# Let RS record the real IP address of the client
#1. Add the following parameters to haproxy. cfg.
Listen www
...
Option forwardfor
# If the backend server needs to obtain the real ip address of the client, the parameters must be placed in the listen module.
#2. If apache is used, add the following parameters.
LogFormat "\" % {X-Forwarded-For} I \ "% l % t \" % r \ "%> s % B \" % {Referer} I \"\ "% {User-Agent} I \" "combined
The parameter "\" % {X-Forwarded-For} I \ can record IP addresses.
#3. If the backend RS is nginx, add the following parameter:
Set_real_ip_from ip; (this ip address is the proxy ip address)
Real_ip_header X-Forwarded-;
Log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request "'
'$ Status $ body_bytes_sent' $ http_referer "'
'"$ Http_user_agent" "$ http_x_forwarded_for "'
========================================================== =====
Add the $ remote_addr or $ http_x_forwarded_for parameter to log_format.
Haproxy + Keepalived build Weblogic high-availability server Load balancer Cluster
Keepalived + HAProxy configure high-availability Load Balancing
Haproxy + Keepalived + Apache configuration notes in CentOS 6.3
Haproxy + KeepAlived WEB Cluster on CentOS 6
Haproxy + Keepalived build high-availability Load Balancing
Configure an HTTP Load balancer using HAProxy
For details about HAproxy, click here
HAproxy: click here
This article permanently updates the link address: