Is it possible to forward NON-http connecting request to some other port in nginx? Is it possible to forward NON-http connecting request to some other port in nginx? nginx nginx

Is it possible to forward NON-http connecting request to some other port in nginx?


It is possible since nginx 1.9.0:

http://nginx.org/en/docs/stream/ngx_stream_core_module.html

Something along these lines (this goes on top level of nginx.conf):

stream {    upstream backend {        server backend1.example.com:12345;    }    server {        listen 12345;        proxy_pass backend;    }}


This is technically possible for sure.

You can modify open source tcp proxies like nginx module called nginx_tcp_proxy_module or HAproxy.

Or you can write a nginx module similar to above one to do this for you.


if nginx remote proxying with HTTP, your client could use the HTTP CONNECT command, then it connects with the remote port and forwards all data as "raw" (or at least I think so).