Forum: NGINX memcached configuration issue

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
99a25fe75cdf8ef4a6d7184f6ea6b740?d=identicon&s=25 Tom Churchill (Guest)
on 2008-11-11 06:29
(Received via mailing list)
I hope you will forgive my asking for help on what I assume is a fairly
obvious error of some sort -- but it's one I'm afraid I can't figure

Basically, we have a cherrypy back end server that will resolve layer
to IP address, handling requests of the form:




The back end server sets a memcache key/value pair so that the next time
around, nginx can avoid the "@cache_miss" proxy pass.

For the most part, all works well -- if I request the name of a key in
memcached, ("test", for example) -- it gets returned.  Likewise, if I
request a key NOT in memcached, the request gets sent to my server.

However, there are a couple of classes of layers that can be handled
generically:  ANY layer starting with "es_" or "api_" will go to the
host: So no need to clutter memcached, right?  Just convert the key so
it is identical for all such requests...

When I attempt to do so using the code fragment below, however, I get
what I
believe is unusual behavior -- requests for anything starting with "es_"
"api_" return nothing -- no HTTP headers, no nothing.

Any thoughts on why?



        location /resolve {
                default_type  text/html;

                set $memcached_key "api:/resolve?$args";
                if ($args ~ "layer=es_") {
                        set $memcached_key "api:/resolve?layer=es_";
                if ($args ~ "layer=api_") {
                        set $memcached_key "api:/resolve?layer=api_";
                memcached_pass localhost:11211;
                error_page 404 = @cache_miss;
This topic is locked and can not be replied to.