nginx memcache for redirecta

agentzh agentzh at gmail.com
Tue Nov 3 06:11:16 MSK 2009


On Tue, Nov 3, 2009 at 11:04 AM, agentzh <agentzh at gmail.com> wrote:
>        location / {
>            eval $my_real_url {
>                set $memcached_key $request_uri;

It may be worth mentioning that the eval block, i.e., eval $foo { ...
}, actually creates a temporary location for our memcached_pass
settings.  An example of the temporary location looks like
"/eval_136351308". So using the $uri variable to set the memcached key
won't work here because $uri evaluates to the URL of the current
(sub)request.

Even $request_uri does not actually evaluates to the (unparsed form
of) main request's URI due to a "bug" in ngx_http_subrequest which
simply passes the parent request's r->unparsed_uri directly to the
newly-created subrequest's unparsed_uri field. So we're actually using
a "bug" as a "feature" here ;)

Cheers,
-agentzh





More information about the nginx mailing list