How to modfiy headers in and headers out

Yingyuan Cheng yingyuan at staff.sina.com.cn
Wed Oct 31 14:45:39 MSK 2007


After changed the order of my filter module defined in
objs/ngx_modules.c which should go after ngx_http_header_filter module,
it works. But I still get a segment fault when calling
ngx_list_push(&r->headers_out.headers) in filter hook function.

Anyone could give me a explanation?

Thanks very much.

--
yingyuan

Yingyuan Cheng 写道:
> Hello all.
>
> I want to write a balancer module to balance requests based on cookie.
> In the phase of upstream_init_peer, I lookup special cookie from
> headers_in.headers. If not found, I'll generate a new one, insert it
> into headers_in.headers which would be packed to backend fastcgi
> processes. After that, I need to modify headers_out.headers, so that the
> newly generated cookie can be sent to clients.
>
> The problem is I could't modfiy headers_out.headers in the phase of
> upstream_init_peer. If I call ngx_list_push(&r->headers_out.headers),
> there would be a segment fault. I ever tried to modify it in the header
> filter phase, but the hook for filter and the hook for balancer seem not
> working together.
>
> Is there any way to work around?
>
> Thanks.
>
> --
> yingyuan
>
>
>   







More information about the nginx mailing list