Jacky Tang's Blog

How to Get the Client’s “Real” IP Address with Envoy Gateway ?

Just as a river flows from its source through various bends before reaching the sea, a typical HTTP request travels from a client across multiple network hops until it reaches its destination server. During this journey, the request’s original IP address is lost as it moves through multiple network infrastructures such as proxy servers and load balancers. This happens because some of these hops terminate the TCP connection and create a new TCP connection with the next hop.

如何通过 Envoy Gateway 得到客户端的真实 IP 地址?

本文将介绍使用 X-Forwarded-For Header、自定义 HTTP Header 和代理协议这些方法来获取客户端真实地址的原理,以及如何采用 Envoy Gateway 来方便地获取到客户端的真实 IP 地址,并基于客户端 IP 地址进行对请求进行访问控制、限流等操作,以提高应用的安全性和可用性。