Welcome! Log In Create A New Profile


proxy_protocol send incorrect header

Rozhuk Ivan
October 30, 2023 08:06AM

I got incorrect proxy header:
PROXY TCP4 unix:/var/run/nginx_443_test.sock 9795 0\r\nSSH-2.0-OpenSSH_9.3\r\n

PROXY TCP4 9795 443\r\nSSH-2.0-OpenSSH_9.3\r\n

My config: - initiator and tcp server on 4443 port. - nginx host

ssh root@ -p 443

tcp server on 4443: any app that can accept tcp and print received data.

nginx config:
# Set default for TLS and non TLS connections.
map $ssl_preread_protocol $upstream_proto_val {
"" unix:/var/run/nginx_443_test.sock;
default unix:/var/run/nginx_443_http.sock;

# ALPN map table.
map $ssl_preread_alpn_protocols $upstream_alpn_val {
default $upstream_proto_val;
"xmpp-client" unix:/var/run/nginx_443_xmpp.sock;
"xmpps-client" unix:/var/run/nginx_443_xmpp.sock;
"stun.turn" unix:/var/run/nginx_443_stun.sock;
"stun.nat-discovery" unix:/var/run/nginx_443_stun.sock;

# ALPN router.
server {
listen *:443 rcvbuf=1m sndbuf=1m so_keepalive=30m::10;
listen [::]:443 rcvbuf=1m sndbuf=1m so_keepalive=30m::10 ipv6only=on;

ssl_preread on;
#proxy_protocol $proxy_protocol_val;
proxy_protocol on;
proxy_pass $upstream_alpn_val;

server {
listen unix:/var/run/nginx_443_test.sock proxy_protocol rcvbuf=1m sndbuf=1m;

set_real_ip_from unix:;

proxy_protocol on;

# Strip proxy protocol for xmpp.
server {
listen unix:/var/run/nginx_443_xmpp.sock proxy_protocol rcvbuf=1m sndbuf=1m;

proxy_protocol off;


PS: it will be very nice if this "proxy_protocol $proxy_protocol_val;" will work. It does not accept vars, only static values from config.

nginx mailing list
Subject Author Posted

proxy_protocol send incorrect header

Rozhuk Ivan October 30, 2023 08:06AM

Re: proxy_protocol send incorrect header

Roman Arutyunyan October 30, 2023 09:02AM

Re: proxy_protocol send incorrect header

Rozhuk Ivan October 30, 2023 10:48AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 324
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready