conditional behaviour based on Accept: values

gabriele renzi rff.rff at
Fri Mar 7 17:58:30 MSK 2008

Hi everyone,

I just started to use nginx and it seems great, thanks to everyone
involved in code or docs.
But of course, now I hit a small problem: how can I access the values
proposed from the client via the Accept: header and behave according
to that?

In context: I'm emitting different values based on this value and I'd
like to take advantage of nginx to properly cache them.
Ideally, I'd like to do something like

if ("rdf" ~* accepts ) {
  set $memcached_key $uri.rdf;
if ("json" ~* accepts ) {
  set $memcached_key $uri.json;

set $memcached_key $uri.html;

yeah, maybe avoiding the triple call to memcached_pass, too :)

It this possible somehow? I' tried to look at the HttpCore module, but
I could not understand if there is a way to do it.

thanks in advance for any help.

More information about the nginx mailing list