Communicating between nginx' modules

Srebrenko Šehić ssehic at
Mon Dec 21 13:44:57 MSK 2009

On Mon, Dec 21, 2009 at 2:58 AM, agentzh <agentzh at> wrote:

> Actually, nginx variables can also be used for this purpose ;)
> Especially in the subrequest context. A parent request passes
> information to an nginx variable that a subrequest's handler can
> recognize. This will work because according to the current
> implementation of ngx_http_subrequest, the subrequest will inherit the
> parent request's r->variables ;) Mudding with another module's context
> might be a bad idea when that module is not yours :)

I tried that by using r->variable("mykey", "myvalue") from a Perl
handler, but the variable was unavailable in another module. It turns
out that ngx_perl_module stashes this variable under it's own ctx()
which is not directly available in another module. Unless you try
poking around r->ctx array and go look for it.

I'm really missing a way to identify other modules. It would be really
nice if modules had an id (in Apache, that is the filename) that could
be looked up by other modules.

Any tips on how to identify other modules?

More information about the nginx-devel mailing list