Haproxy Let back-end RS record real IP

Source: Internet
Author: User
Tags haproxy

#让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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.