Atif,<br><br>You will most likely need to use the error_page directive to fallback to an internal location.  Something like what I have below should be work-able.  Disclaimer: I have not tested this, and I do not know how the memcached module works (it may reconnect to the memcached server for each check, lowering performance).<br>
<br>location / {<br>  error_page 404 = @site;<br>  set $memcached_key /lock/$remote_addr;<br>  memcached_pass <a href="http://10.10.10.1:11211">10.10.10.1:11211</a>;<br>}<br><br>location @site {<br>  internal;<br>  error_page 404 = @app;<br>
  set $memcached_key /lock/$host;<br>  memcached_pass <a href="http://10.10.10.1:11211">10.10.10.1:11211</a>;<br>}<br><br>location @app {<br>  ... whatever you normally pass to...<br>}<br><br>- Merlin<br><br><div class="gmail_quote">
On Tue, Mar 24, 2009 at 6:26 PM, Atif Ghaffar <span dir="ltr">&lt;<a href="mailto:atif.ghaffar@gmail.com">atif.ghaffar@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br><br>I would like to test 2 memcached keys before passing to the content.<br><br>Background:<br>Our CMS app has DDOS protection that can lock and IP ($remote_addr) or the complete website ($host)<br><br>For example if an IP is misbehaving then there is a key like /lock/<a href="http://192.168.123.123" target="_blank">192.168.123.123</a>  (DOS protection)<br>

If this key is present then I just want to return the value of the key &quot;Sorry. too many requests from your IP, etc&quot;<br><br>This is fine.<br><br>location / {<br> set $memcached_key /lock/$remote_addr;<br> memcached_pass <a href="http://10.10.10.1:11211" target="_blank">10.10.10.1:11211</a>;<br>

 ...<br> do something with the request<br>}<br><br>The second scenario is that a fleet of machines are attacking a single website (DDOS) then there will a lock such as<br>/lock/<a href="http://mysite.com" target="_blank">mysite.com</a><br>

<br>So my question is: Is it possible to check both keys such as<br><br>location / {<br> 
set $memcached_key /lock/$remote_addr;<br>

 memcached_pass <a href="http://10.10.10.1:11211" target="_blank">10.10.10.1:11211</a>;<br>
<br> set $memcached_key /lock/$hostr;<br>

 memcached_pass <a href="http://10.10.10.1:11211" target="_blank">10.10.10.1:11211</a>;<br>

 

<br>...<br>
 do something with the request<br>
}<br><br><br><br><br clear="all"><br>-- <br>best regards<br><font color="#888888">Atif Ghaffar<br>
</font></blockquote></div><br>