title: How to log the real client IP on embedded Tomcat access log on Spring Boot application with Nginx as reverse proxy?
body: <p>I have Nginx in front of a Spring Boot 1.3.3 application with Tomcat access log enabled, but the logging always write the proxy IP address (127.0.0.1) instead of the real client IP.</p>
  
  <ol>
  <li>Is the X-Real-IP header used to get the real client IP?</li>
  <li>Is this header used by tomcat to write the IP address in the access log?</li>
  </ol>
  
  <p>I have this configuration:</p>
  
  <p>application.properties</p>
  
  <pre><code>server.use-forward-headers=true
  server.tomcat.internal-proxies=127\\.0\\.0\\.1
  server.tomcat.accesslog.enabled=true
  </code></pre>
  
  <p>Nginx configuration:</p>
  
  <pre><code>location / {
      proxy_pass http://127.0.0.1:8091;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto https;
      proxy_set_header X-Forwarded-Port 443;
      proxy_set_header Host $host;
  }
  </code></pre>