How to modfiy headers in and headers out
yingyuan at staff.sina.com.cn
Wed Oct 31 11:03:17 MSK 2007
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
Is there any way to work around?
More information about the nginx