# \--add\_module for filters?

**URL:** <https://www.ruby-forum.com/t/add-module-for-filters/150133>\
**Category:** NGINX\
**Created:** [October 4, 2008, 7:26am UTC](https://www.ruby-forum.com/t/add-module-for-filters/150133 "2008-10-04T07:26:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdmcnitt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a4c791/32.png) [@bdmcnitt](https://www.ruby-forum.com/u/bdmcnitt)\
**Post date:** [October 4, 2008, 7:26am UTC](https://www.ruby-forum.com/t/add-module-for-filters/150133/1 "2008-10-04T07:26:39Z")

</div>

I’m trying to write a bare-bones body and header filter (just prints a  
debugging message for headers and the body), and found that when I put  
added it to the configuration with the --add-module configure directive,  
it was placed BEFORE all of the filters in the load order (especially  
the write filter). This meant that the http\_write filter was called  
before my filter, and my filter was never getting called (http\_write  
emits the output, assuming it’s at the ‘top’ of the chain).

Moving my module to the bottom of the list, after the  
http\_not\_modified\_filter\_module in the objs/ngx\_modules.c file, I was  
able to get it to work as expected.

Besides editing objs/ngx\_modules.c to manually place my module in the  
correct order, is there any way to add in a non-standard filter into the  
correct order in nginx’s configure command?

thanks,

-Brian M.

---

<div class="post-metadata">

**Author:** ![bdmcnitt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a4c791/32.png) [@bdmcnitt](https://www.ruby-forum.com/u/bdmcnitt)\
**Post date:** [October 4, 2008, 12:08pm UTC](https://www.ruby-forum.com/t/add-module-for-filters/150133/2 "2008-10-04T12:08:37Z")

</div>

Hello!

On Fri, Oct 03, 2008 at 10:18:44PM -0700, Brian M. wrote:

> able to get it to work as expected.
> 
> Besides editing objs/ngx\_modules.c to manually place my module in the  
> correct order, is there any way to add in a non-standard filter into the  
> correct order in nginx’s configure command?

In your module config file write something like this:

HTTP\_AUX\_FILTER\_MODULES="$HTTP\_AUX\_FILTER\_MODULES  
ngx\_http\_my\_filter\_module"

You are probably adding it to $HTTP\_MODULES instead, which is  
wrong for filter modules.

Maxim D.

---

<div class="post-metadata">

**Author:** ![bdmcnitt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a4c791/32.png) [@bdmcnitt](https://www.ruby-forum.com/u/bdmcnitt)\
**Post date:** [October 6, 2008, 6:38pm UTC](https://www.ruby-forum.com/t/add-module-for-filters/150133/3 "2008-10-06T18:38:34Z")

</div>

Thanks, I’ll change my project to reflect that!
