title: Using Nginx to block IP's behind proxy
body: <p>I'm running a Nginx 1.2.4 webserver here, and I'm behind a proxy of my hoster to prevent ddos attacks. The downside of being behind this proxy is that I need to get the REAL IP information from an extra header. In PHP it works great by doing <code>$_SERVER[HTTP_X_REAL_IP]</code> for example.</p>
  
  <p>Now before I was behind this proxy of my hoster I had a very effective way of blocking certain IP's by doing this: <code>include /etc/nginx/block.conf</code> and to allow/deny IP's there.</p>
  
  <p>But now due to the proxy, Nginx sees all traffic coming from 1 IP.</p>
  
  <p>I have configurated Nginx with <code>--with-http_realip_module</code> so I should now be able to get the real IP's from people.</p>
  
  <p>In my nginx.conf I have added:</p>
  
  <pre><code>real_ip_header X-Forwarded-For;
  include blockips.conf;
  </code></pre>
  
  <p>I have also tried:</p>
  
  <pre><code>real_ip_header X-Real-IP;
  include blockips.conf;
  </code></pre>
  
  <p>In both cases IP's listed in blockips.conf are not being blocked. Also in my log files I do not see the real ip's, but only the proxy IP show up.</p>
  
  <p>What am I doing wrong?</p>