Why body filter not work

Maxim Dounin mdounin at mdounin.ru
Wed Aug 6 12:46:18 UTC 2014


Hello!

On Wed, Aug 06, 2014 at 02:58:16PM +0800, Jerry OELoo wrote:

> Hi.
> I just copy the code from Evan Miller's body filter.
> http://www.evanmiller.org/nginx-modules-guide.html#filters-body,
> however, In my browser I could not see inserted string (<!-- Served by
> Nginx -->)

The chapter in question doesn't looks correct - it tries to modify 
chain links passed to the filter (that is, chain links that belong 
to some other module), which is wrong thing to do.  Instead, one 
should allocate new chain links, and construct a new chain with 
them.

In any case though it may be better idea to test with something 
more suitable for testing than browser.  E.g., telnet or netcat 
may be better.

> And I found that request header.
> 
> Transfer-Encoding: chunked
> 
> Is anything that I am wrong. Thanks.

The "Transfer-Encoding: chunked" header is correct as long as 
response size isn't known in advance.  See here for details:

http://tools.ietf.org/html/rfc7230#section-4.1

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



More information about the nginx mailing list