I'm trying to use Nginx as proxy for my TCP daemon, to make Nginx be SSL/TLS frontend, as well as load control.
My backend app needs real client IP, and this is a problem.
stream {
server {
listen 3333;
proxy_pass 127.0.0.1:2222;
}
}
I found one solution in docs:
proxy_bind $remote_addr transparent;
But it's too complicated:
"In order for this parameter to work, it is necessary to run nginx worker processes with the superuser privileges and configure kernel routing table to intercept network traffic from the proxied server."
Is there any other way to pass $remote_addr to backend?
I tried modify client message body using sub_filter, send http headers, etc. But all of this can work only with http context, not with stream unfortunately.