Member-only story
The Challenges of IP Address Detection in a Multi-Step Connection Scenario in Symfony Projects

NOTE: Any time I mention NGINX, it is interoperable by Apache, IIS or any other server you might have condifured in your environment. I am going to consider the NGINX settings in this article, but you can replicate the same behaviour for your Web Proxy server to achieve the same result.
The Internet Protocol (IP) address plays a pivotal role in the identity of an online user. It’s a unique string of numbers separated by periods that identifies each computer using the Internet Protocol to communicate over a network. IP addresses are paramount for servers to recognise and interact with clients. However, accurately identifying the IP address in a web app environment can be challenging, particularly in a multi-step connection scenario like the one we’re discussing.
Scenario Description
In this article, we are going to investigate a setting where a user connects to a Symfony web application via multiple steps: first through the Cloudflare DNS resolver, then an Nginx proxy on the hosting server, and finally, the primary Nginx server hosting the Symfony web app inside a Docker container.