title: Limit nginx requests by http verb
body: <p>Any way to use nginx (1.6.0) to limit requests by verb?</p>
  
  <p>For example, allow a maximum of 15 <code>GET</code>s per second but only 3 <code>POST</code>s per second for any one ip address?</p>
  
  <p>Currently trying to use the following gives an error in the nginx error log of:</p>
  
  <pre><code>2014/05/20 16:24:39 [emerg] 1914#0: "limit_req" directive is not allowed here in /etc/nginx/sites-enabled/site.conf:13
  </code></pre>
  
  <p><code>site.conf</code> Included inside http block.</p>
  
  <pre><code># Rate limiting
  limit_req_zone $binary_remote_addr zone=get_requests:10m rate=15r/s;
  limit_req_zone $binary_remote_addr zone=post_requests:10m rate=3r/s;
  limit_req_status 429;
  
  server {
    listen 4000;
  
    # Rate limiting
    limit_req zone=get_requests;
    if ($request_method = 'POST') {
      limit_req zone=post_requests;
    }
  
    location / {
    }
  }
  </code></pre>
  
  <p><strong>Edit 1</strong></p>
  
  <p>I've also tried inserting the following conditional break clause after <code>location /</code> but that doesn't work as the system is limited to 1 request per second:</p>
  
  <pre><code>limit_req zone=get_requests;
  if ($request_method != 'POST') {
    break;
  }
  limit_req zone=post_requests;
  </code></pre>