title: Remote IP Address for HttpServletRequest Object being obscured by Apache Proxy
body: <p>I am writing an application in Java that serves a web page with data from an underlying database.  I am limiting access to the web page based on some IP restrictions.  Basically any IP that falls into the 'Accepted' range will be allowed to access the web page and any IP outside of this range will be redirected to an error page.  To get the IP address of the user attempting to access the page I am using the following:</p>
  
  <pre><code>String userIPAddress = request.getRemoteAddr();
  </code></pre>
  
  <p>Where 'request' is my HttpServletRequest Object.</p>
  
  <p>The issue I am running into is that this web page is being proxied through an Apache Web Server.  </p>
  
  <p>When this happens, it loses the clients IP address and adopts the IP address of our firewall.  So when I access request.getRemoteAddr(), it will return the same IP no matter where the customer attempts to access the web page from.</p>
  
  <p>When accessing the web page internally via direct IP address my IP check works just fine.  The issue presents itself when you access through the proxy.</p>
  
  <p>Is there anything that I can do programmatically to access the clients actual IP address?  Or is this something that has to be done/changed via the Apache web server to allow this information to pass through?  In that case I can post to Server Fault if that would be a better forum.</p>
  
  <p>Your help is greatly appreciated.</p>
  
  <p>Best Regards.</p>