Welcome! Log In Create A New Profile

Advanced

Re: [nginx] problem with a sample module

Jérôme Loyet
June 01, 2010 04:42AM
Le 1 juin 2010 09:23, Jérôme Loyet <jerome@loyet.net> a écrit :
> 2010/6/1 Igor Sysoev <igor@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

I found the solution:
HTTP_MODULES="$HTTP_MODULES ngx_http_xtoken_module"
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES ngx_http_xtoken_module"

If I need extra libs. Is there a way to check the availability of
header files and libs at configure ?

thx
++ jerome

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] problem with a sample module

Jérôme Loyet 4130 June 01, 2010 02:38AM

Re: [nginx] problem with a sample module

Igor Sysoev 1252 June 01, 2010 02:44AM

Re: [nginx] problem with a sample module

Jérôme Loyet 1088 June 01, 2010 03:26AM

Re: [nginx] problem with a sample module

Jérôme Loyet 1223 June 01, 2010 04:42AM

Re: [nginx] problem with a sample module

agentzh 1088 June 01, 2010 05:00AM

Re: [nginx] problem with a sample module

Jérôme Loyet 1405 June 01, 2010 05:04AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 165
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready