How do I restore original visitor port with Nginx?


I’m currently restoring the original IP, but I’m having trouble restoring the original port, getting instead the one that cloudflare’s using.
I’m trying to use $realip_remote_port but it doesn’t work

Is it possible? How are you doing it?


Just curious. Why would you even need remote port which is most likely just random (from certain set)?


Turns out the police can’t identify users from mobile networks with just the IP, they need the port too




Let me see what info I can dig up on this question. Stay tuned!


@niciusb - we did some digging and don’t believe there is a solution for what you are looking for.


I have the same problem. Police need the port number. IP is not enought. Is any possibilty to add something simmilar to HTTP_CF_CONNECTING_IP like HTTP_CF_CONNECTING_PORT ?