Memcached/JSONP

agentzh agentzh at gmail.com
Wed Dec 23 08:54:36 MSK 2009


On Wed, Dec 23, 2009 at 1:47 PM, agentzh <agentzh at gmail.com> wrote:
> Understood. How about this?
>
>   location /first {
>     echo "before";
>     echo_location_async /second $uri;
>     echo "after";
>   }
>
>   location = /second {
>     set $memcached_key $query_string;
>     memcached_pass 127.0.0.1;
>   }
>

Actually there's always more than one way to do it in nginx. If you
really want to use regexes and match captures, try the following
version of config with "if" statement:

    location /first {
        echo "before";
        echo_location_async /second $request_uri;
        echo "after";
    }

    location = /second {
         if ($query_string ~ '([^?]+)') {
             set $memcached_key $1;
             echo $memcached_key;
         }
    }

Tested successfully on my side ;)

Happy hacking nginx config files! :D

Cheers,
-agentzh



More information about the nginx mailing list