[PATCH] Keep remote port unchanged if real address doesn't contain a port.

Ruslan Ermilov ru at nginx.com
Mon Jan 20 14:26:24 UTC 2020


On Mon, Jan 20, 2020 at 08:27:42PM +0800, Zexuan Luo wrote:
> # HG changeset patch
> # User spacewander <spacewanderlzx at gmail.com>
> # Date 1579523127 -28800
> #      Mon Jan 20 20:25:27 2020 +0800
> # Branch ident
> # Node ID 86dbfc59e9c01608244c4fdc0d9a87fd9d330648
> # Parent  4fb5603514f2d324c50cb7e12c6ed0dc8935de0f
> Keep remote port unchanged if real address doesn't contain a port.
> 
> Previously, when the request comes from a trusted address and it doesn't
> contain
> the port part, the $remote_port will be empty.
> 
> This change has two advantages:
> 1. no need to write your own fallback with $remote_port and
> $realip_remote_port.
> 2. the $remote_port in the existent code doesn't need to be changed.

Preserving the port while changing the client address would be
misleading.  Also, it's been the behavior before realip learned
how to change the client's port (1.11.0).  Thus, it's believed
that the current behavior is correct.


More information about the nginx-devel mailing list