title: Rails - difference between request.env['HTTP_X_FORWARDED_FOR'] and request.remote_ip
body: <p>I am adding some changes to existing RoR application and found out that <code>request.env['HTTP_X_FORWARDED_FOR']</code> returned <code>nil</code>. I changed that to <code>request.remote_ip</code> and got right IP address of the client.</p>
  
  <p>Why does <code>request.remote_ip</code> return an IP when <code>request.env['HTTP_X_FORWARDED_FOR']</code> returns <code>nil</code>? What's the difference between them? How can I make <code>request.env['HTTP_X_FORWARDED_FOR']</code> work and which one should I use (best practice)? </p>