#让RS记录客户端的真实IP
#1. Add the following parameters to the Haproxy.cfg first.
Listen www...option forwardfor #如果后端服务器需要获得客户端真实ip需要配置的参数, must be placed under the Listen module
#2. If it is Apache, add the following parameter
Logformat "\"%{x-forwarded-for}i\ "%l%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" combined is mainly "\"%{ X-forwarded-for}i\ This parameter can record IP
#3. If the rear-end RS is Nginx, add the following parameters
Set_real_ip_from IP, (this IP is filled with proxy IP) Real_ip_header x-forwarded-for;
Log_format Main ' $remote _addr– $remote _user [$time _local] "$request" "$status $body _bytes_sent" $http _r Eferer "" "$http _user_agent" "$http _x_forwarded_for" ' ============================================= in Log_fo Add $remote_addr or $http_x_forwarded_for parameters to the Rmat.
This article is from the "Struggle Bar" blog, please be sure to keep this source http://lvnian.blog.51cto.com/7155281/1710389
Haproxy Let back-end RS record real IP