[nginx] problem with a sample module

Jérôme Loyet jerome at loyet.net
Tue Jun 1 11:23:57 MSD 2010


2010/6/1 Igor Sysoev <igor at sysoev.ru>:
> On Tue, Jun 01, 2010 at 08:36:05AM +0200, Jérôme Loyet wrote:
>
>> Hi,
>>
>> I'm writing a very simple module which add a header.
>>
>> In the postconfigure function, I backup up ngx_http_top_header_filter
>> and set my own filter instead.
>>
>> static ngx_int_t
>> ngx_http_xtoken_init(ngx_conf_t *cf)
>> {
>>   ngx_http_next_header_filter = ngx_http_top_header_filter;
>>   ngx_http_top_header_filter = ngx_http_xtoken_clear_cookie_handler;
>>   return NGX_OK;
>> }
>>
>> But the function ngx_http_xtoken_filter seems to be never called.
>>
>> The module is compile with --add-module=/path/to/module
>>
>> do you have any clue of what I did wrong ?
>
> In /path/to/module/config you should change:
>
> - HTTP_MODULES="$HTTP_MODULES ngx_http_xtoken_module"
> + HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES ngx_http_xtoken_module"
>

thx igor.

Is there a way to make a module as an output filter (to add a cookie),
as an NGX_HTTP_ACCESS_PHASE handler (to check if a cookie exists) and
as a content generator (like empty_gif) ? I mean all at once, or I
have to write a different module for each task ?

++ Jerome

>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://nginx.org/mailman/listinfo/nginx-devel
>



More information about the nginx-devel mailing list