We are trying to follow a TCP connection from the TCP client via the nginx reverse proxy to the target. So nginx is the reverse proxy to which the client connects. nginx then connects to the target using a new TCP port. We need to log the TCP Port nginx used (as a client) to connect to the target. We currently use the variables $remote_port and $server_port, but these do not log what we need. $by erik.nellessen - Nginx Mailing List - English