title: Nginx real client IP to TCP stream backend
body: <p>I'm trying to use Nginx as proxy for my TCP daemon, to make Nginx be SSL/TLS frontend, as well as load control.</p>
  
  <p>My backend app needs real client IP, and this is a problem.</p>
  
  <pre><code>stream {
      server {
          listen     3333;
          proxy_pass 127.0.0.1:2222;
      }
  }
  </code></pre>
  
  <p>I found one solution in docs:</p>
  
  <pre><code>proxy_bind $remote_addr transparent;
  </code></pre>
  
  <p>But it's too complicated:</p>
  
  <blockquote>
    <p>"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."</p>
  </blockquote>
  
  <p>Is there any other way to pass $remote_addr to backend?</p>
  
  <p>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.</p>