Order of execution of nginx filters

Andrew Hutchings ahutchings at nginx.com
Tue Jul 5 09:40:02 UTC 2016


Hi Gopal,

If you are compiling as dynamic modules you can specify filter order in 
the module's 'config' file:

https://www.nginx.com/resources/wiki/extending/new_config/#key-ngx_module_order

Hope this helps.

Kind Regards
Andrew

On 04/07/16 22:51, Raghavan, Gopal wrote:
> Hi
>
>
>
> I have the following three directives:
>
>
>
> location = /hello {
>
>                  hello_world;
>
>                  hola_mundo on;
>
>                  bonjour_monde on;
>
> }
>
>
>
> hello_world is an nginx handler module that provides content “hello world”
>
> hola_mundo and bonjour_monde are filters that add to the chain strings
> “hola mundo” and “bonjour monde” respectively.
>
>
>
>
>
> Here is the output:
>
> curl  "http://localhost:8090/hello"
>
> hello worldhola mundobonjour monde
>
>
>
>
>
> Switching the filter directives in location block has no impact on
> output string.
>
>
>
> For eg:
>
>
>
> location = /hello {
>
>                  hello_world;
>
> bonjour_monde on;
>
>                  hola_mundo on;
>
> }
>
>
>
> Here is the output:
>
> curl  "http://localhost:8090/hello"
>
> hello worldhola mundobonjour monde
>
>
>
>
>
> How do I control the order of execution of filters?
>
> I already looked at objs/ngx_modules.c and auto/modules. My custom
> handlers and filters are not listed there.
>
>
>
> One thing that I observed is that the order of listing the load_module
> modules/*.so in conf/nginx.conf does impact the order of execution of
> the filters.
>
>
>
> Is there any other trick to adjust the execution order within the
> location block?
>
>
>
> Thanks,
>
> --
>
> Gopal
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>

-- 
Andrew Hutchings (LinuxJedi)
Technical Product Manager, NGINX Inc.



More information about the nginx-devel mailing list