Wha difference between HTTP_FILTER_MODULES and HTTP_AUX_FILTER_MODULES is it?

If we want add a “string filter”, which chain should be registered?

thanks
NextHop

Hello!

On Tue, Nov 23, 2010 at 08:00:55AM -0800, quan nexthop wrote:

If we want add a “string filter”, which chain should be registered?

Third party filters should use HTTP_AUX_FILTER_MODULES (unless
there is a really good reason to register elsewhere, e.g. you are
developing something like bzip2 filter and need response with
joined subrequests).

Maxim D.

Hi Maxim:

Thanks your response quickly.
I try to development a filter module(string filter for request body),
however, I found that

  1. use HTTP_FILTER_MODULES to register, the module works well
  2. use HTTP_AUX_FILTER_MODULES, it does not work.

I wonder why there is two different behavior for the MODULE_NAME;
I also check the config file of NGINX, there are several MODULE :

if [ $HTTP = YES ]; then
modules="$modules $HTTP_MODULES $HTTP_FILTER_MODULES
$HTTP_HEADERS_FILTER_MODULE
$HTTP_AUX_FILTER_MODULES
$HTTP_COPY_FILTER_MODULE
$HTTP_RANGE_BODY_FILTER_MODULE
$HTTP_NOT_MODIFIED_FILTER_MODULE
$HTTP_UPSTREAM_CACHE_MODELE"

What does it mean and when should it be used ?

thanks
NextHop

Hello!

On Tue, Nov 23, 2010 at 09:22:58AM -0800, quan nexthop wrote:

Hi Maxim:

Thanks your response quickly.
I try to development a filter module(string filter for request body),
however, I found that

  1. use HTTP_FILTER_MODULES to register, the module works well
  2. use HTTP_AUX_FILTER_MODULES, it does not work.

So the question are: what your module does exactly (i.e. sources),
how do you add it (i.e. module ./config source) and how do you
test it (i.e. test case with expected output and output you got).
“Does not work” means basically nothing.

Assuming correct module code and ./config script the only
difference between adding filter to HTTP_AUX_FILTER_MODULES and
HTTP_FILTER_MODULES is that in later case your module will be able
to see output headers added by headers filter (i.e. add_header
directive). With something being incorrect things may vary widely.

         $HTTP_UPSTREAM_CACHE_MODELE"

It looks like you’ve already screwed up your nginx sources. There
shouldn’t be anything like “HTTP_UPSTREAM_CACHE_MODELE” here.
Re-downloading/extracting nginx sources may be a good idea.

What does it mean and when should it be used ?

There are lots of modules in nginx, and each of them needed for
something. Feel free to read docs and sources to find out what
exactly each module is needed for. These part of configure script
basically lines up various http modules and http filter modules.

And again: the only place in the filter chain where third party
modules is expected be installed is HTTP_AUX_FILTER_MODULES. You
should have really good reason to install your module anywhere
else, and if you do it - you do it at your own risk.

Maxim D.