Establish TCP connection to upstream when client connection made to listener
Francis Daly
francis at daoine.org
Fri Mar 20 14:43:21 UTC 2020
On Fri, Mar 20, 2020 at 09:57:40AM -0400, Phillip Odam wrote:
Hi there,
> I'm looking for when a client establishes a TCP connection to an IP and
> port, that NGINX is listening on, that NGINX, without waiting on data being
> transmitted from the client to NGINX, would establish a TCP connection to
> the upstream.
What happened when you tried it?
A quick test here of "nc -l 9005", plus nginx.conf with
==
stream {
server {
listen 9001;
proxy_pass 127.0.0.3:9005;
}
}
==
and "tcpdump -nn -i any -X -s 0 port 9005 or port 9001", seems to show
that "nc localhost 9001" leads to a tcp handshake involving port 9001
(from the client to nginx) and a tcp handshake involving port 9005
(from nginx to the upstream).
> Trouble with this though, NGINX then can't fully support reverse proxying
> protocols where the server provides a response upon TCP connection eg. SSH2,
> MySQL. You're instead dependent on the client handling the lack of initial
> server response and that after the client sends its first lot of data it'll
> then receive the server's initial response.
Do you have a specific test case that shows this problem?
==
stream {
server {
listen 9001;
proxy_pass 127.0.0.3:22;
}
}
==
and "ssh -v -p 9001 localhost" would seem to indicate that it Just Works.
Perhaps my testing is wrong?
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list