Opened 7 years ago

Closed 7 years ago

#1428 closed enhancement (duplicate)

Expose the proxy protocol port in a variable

Reported by: Congelli501@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.13.x
Keywords: proxyprotocol Cc:
uname -a: Linux node1 4.4.0-96-generic #119-Ubuntu SMP Tue Sep 12 14:59:54 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.13.5
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
built with OpenSSL 1.0.2g 1 Mar 2016
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_sub_module --with-http_v2_module --with-http_v2_hpack_enc --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-file-aio --without-mail_pop3_module --without-mail_smtp_module --without-mail_imap_module --without-http_uwsgi_module --without-http_scgi_module --with-cc-opt='-g -O3 -flto -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 --param=ssp-buffer-size=4 -DTCP_FASTOPEN=23 -Wno-error=strict-aliasing -m64 -mtune=generic' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --add-module=/tmp/build/ngx_devel_kit-0.3.0 --add-module=/tmp/build/set-misc-nginx-module-0.31 --add-module=/tmp/build/nginx-module-vts-0.1.15 --add-module=/tmp/build/headers-more-nginx-module-0.32 --add-module=/tmp/build/nginx-goodies-nginx-sticky-module-ng-08a395c66e42 --add-module=/tmp/build/nginx-http-auth-digest-7955af9c77598c697ac292811914ce1e2b3b824c --add-module=/tmp/build/ngx_http_substitutions_filter_module-bc58cb11844bc42735bbaef7085ea86ace46d05b --add-module=/tmp/build/nginx-opentracing-fcc2e822c6dfc7d1f432c16b07dee9437c24236a

Description

The proxy protocol port provides the port used by the user to contact the proxy protocol proxy.

For example, in this proxy protocol header, the end user contacted the TCP proxy on port 1234:

PROXY TCP4 192.168.0.1 192.168.0.11 56324 1234\r\n
GET / HTTP/1.1\r\n
Host: 192.168.0.11\r\n
\r\n

Right now, nginx doesn't parse the this port, according to the code (https://github.com/nginx/nginx/blob/f8a9d528df92c7634088e575e5c3d63a1d4ab8ea/src/core/ngx_proxy_protocol.c#L99). Only the user port is parsed and exposed through proxy_protocol_port.

It would be a nice feature to expose this port, to forward it to the upstream app and rebuild the correct public URL dynamically.

Change History (4)

comment:1 by Ruslan Ermilov, 7 years ago

Resolution: worksforme
Status: newclosed

comment:2 by Ruslan Ermilov, 7 years ago

Resolution: worksforme
Status: closedreopened

in reply to:  1 comment:3 by Ruslan Ermilov, 7 years ago

Replying to ru:

http://nginx.org/r/$proxy_protocol_port

I misread what you said, sorry.

comment:4 by Maxim Dounin, 7 years ago

Resolution: duplicate
Status: reopenedclosed

Duplicate of #1206.

Note: See TracTickets for help on using tickets.