Buffers Chain

Maxim Dounin mdounin at mdounin.ru
Tue May 27 11:08:14 UTC 2014


Hello!

On Tue, May 27, 2014 at 09:15:28AM +0100, Paulo Silva wrote:

> Hi,
> One more question about buffers chains.
> 
> Is it possible to a body_filter to say to the engine to hang up client
> streaming?
> Maybe say "keep it in memory" (there are a plenty undocumented
> ngx_chain_t members).
> 
> I'm searching for "</head>" on response body and one possibility is to
> get, i.e., "</" on the last buffer of a chain and the "head>" at the
> beginning of the next chain. But on the next body_filter call I will
> not have access to the previous chain, right?
> 
> I was thinking about telling to the engine to hang up the client
> streaming whenever a chain ends with a substring of "</head>".
> The purpose is to inject some HTML right before the </head> so I have
> to manipulate the content of chain->buf.
> 
> It is not possible to use SSI, because nginx is being used as reverse
> proxy and the backend application doesn't know about nginx.

Try looking into sub filter module.

http://hg.nginx.org/nginx/file/tip/src/http/modules/ngx_http_sub_filter_module.c
http://nginx.org/en/docs/http/ngx_http_sub_module.html

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list