How to maintain the real IP of the client when using haproxy for load balancing
The following brings you how to use haproxy to maintain the real IP of the client when doing load balancing, hoping to bring some help to you in practical application. Load balancing involves more things, there are not many theories, and there are many books on the Internet. Today, we will use the accumulated experience in the industry to do an answer.
Add setting items to haproxy
Option forwardfor
Option httpclose
This log_format format acquisition of your application needs to be changed, such as apache's:
LogFormat "% {X-Forwarded-For} I% l% u% t\"% r\ "% > s% b\"% {Referer} I\ "\"% {User-Agent} I\ "" combined
I have read the above about how to maintain the real IP of the client when using haproxy for load balancing. if there is anything else you need to know, you can find what you are interested in in the industry information or find our professional and technical engineers for answers. Technical engineers have more than ten years of experience in the industry.