Using nginx as proxy

Francis Daly francis at
Fri Mar 17 17:28:46 UTC 2017

On Fri, Mar 17, 2017 at 10:13:48AM -0700, Wakkas Rafiq wrote:

Hi there,

> Wonder if nginx can handle proxing non http – tcp traffic

It can; but generally the source port for a tcp connection does not
matter. The nginx stream module has no way (that I know of) to set the
source port of the tcp connection that it makes to its upstream.

(For example: if you had two sessions that both wanted to use source
port 12000 to the same destination server port 3260, I'm pretty sure
that something would go wrong.)

I suspect it may be simpler to find out why the upstream server cares
about the source port of the incoming connection, and see if it can
be changed not to; that to try to configure any generic tcp-forwarder
to use a specific source port for all outgoing connections.

You may have more luck with a dedicated tcp-forwarder that knows it can
only handle a single connection at once.


Francis Daly        francis at

More information about the nginx mailing list