title: Set REMOTE_ADDR to X-Forwarded-For in apache
body: <p>In a situation where Apache is sitting behind a reverse proxy (such as Squid), the cgi environment variable <code>REMOTE_ADDR</code> gets the address of the proxy rather than the client.</p>
  
  <p>However, the proxy will set a header called <code>X-Forwarded-For</code> to contain the original IP address of the client so that Apache can see it.</p>
  
  <p>The question is, how do we get Apache to replace <code>REMOTE_ADDR</code> with the value in the <code>X-Forwarded-For</code> header so that all of the web applications will transparently see the correct address?</p>