conditional behaviour based on Accept: values
gabriele renzi
rff.rff at gmail.com
Fri Mar 7 19:58:32 MSK 2008
On Fri, Mar 7, 2008 at 3:20 PM, Manlio Perillo <manlio_perillo at libero.it> wrote:
> gabriele renzi ha scritto:
> > Hi everyone,
> >
>
> Hi Gabriele!
eilà :)
>
> The value of the accept header can be found in the $http_accept variable.
>
> Every header can be accessed this way:
> http://wiki.codemongers.com/NginxHttpCoreModule#var_args
ah thank you I overlooked that.
> To avoid the triple memcache_pass, you can just do:
<snip/>
no I just meant to avoid writing it 3 times, but with current nginx
this seems to work as I expect it:
if ($http_accept ~* rdf) {
set $memcached_key DATA$uri-$args.rdf;
}
if ($http_accept ~* json) {
set $memcached_key DATA$uri-$args.json;
}
if ($http_accept ~* plain) {
set $memcached_key DATA$uri-$args.txt;
}
memcached_pass memcached;
next I'll have to check if I can do "set $key $key.foo" :)
Thanks again for the help.
More information about the nginx
mailing list