HAproxy allows backend RS to record real IP addresses

Source: Internet
Author: User

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:

Related Article

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.