Multiple passes to memcached with different keys

Atif Ghaffar atif.ghaffar at gmail.com
Wed Mar 25 04:26:39 MSK 2009


Hi all,

I would like to test 2 memcached keys before passing to the content.

Background:
Our CMS app has DDOS protection that can lock and IP ($remote_addr) or the
complete website ($host)

For example if an IP is misbehaving then there is a key like /lock/
192.168.123.123  (DOS protection)
If this key is present then I just want to return the value of the key
"Sorry. too many requests from your IP, etc"

This is fine.

location / {
 set $memcached_key /lock/$remote_addr;
 memcached_pass 10.10.10.1:11211;
 ...
 do something with the request
}

The second scenario is that a fleet of machines are attacking a single
website (DDOS) then there will a lock such as
/lock/mysite.com

So my question is: Is it possible to check both keys such as

location / {
  set $memcached_key /lock/$remote_addr;
 memcached_pass 10.10.10.1:11211;

 set $memcached_key /lock/$hostr;
 memcached_pass 10.10.10.1:11211;

...
 do something with the request
}





-- 
best regards
Atif Ghaffar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090325/8aab5084/attachment.html>


More information about the nginx mailing list