Iñaki Baz Castillo
2009-Dec-27 19:58 UTC
Do we let Nginx to handle response Transfer-Encoding?
Hi, I''ve checked that in case my Rack application (under Unicorn) doesn''t set "Content-Lentgh" neither "Transfer-Encoding", then Nginx automatically adds "Transfer-Encoding: chunked" to the response (and edits the body properly to be in chunked format). However Unicorn is sending a response with body but without "Content-Lentgh" or "Transfer-Encoding", so IMHO it''s incorrect according to RFC 2616. So, should my Rack application handle this stuff? or is it better if I let Nginx "fixing" it for me? Thanks a lot. -- I?aki Baz Castillo <ibc at aliax.net>
I?aki Baz Castillo <ibc at aliax.net> wrote:> Hi, I''ve checked that in case my Rack application (under Unicorn) doesn''t set > "Content-Lentgh" neither "Transfer-Encoding", then Nginx automatically adds > "Transfer-Encoding: chunked" to the response (and edits the body properly to > be in chunked format). > > However Unicorn is sending a response with body but without "Content-Lentgh" > or "Transfer-Encoding", so IMHO it''s incorrect according to RFC 2616. > > So, should my Rack application handle this stuff? or is it better if I let > Nginx "fixing" it for me?Just load the Rack::ContentLength middleware, if you''re building a Rack app from scratch. Some frameworks already handle Content-Length for you. -- Eric Wong
Iñaki Baz Castillo
2009-Dec-28 10:23 UTC
Do we let Nginx to handle response Transfer-Encoding?
El Lunes, 28 de Diciembre de 2009, Eric Wong escribi?:> I?aki Baz Castillo <ibc at aliax.net> wrote: > > Hi, I''ve checked that in case my Rack application (under Unicorn) doesn''t > > set "Content-Lentgh" neither "Transfer-Encoding", then Nginx > > automatically adds "Transfer-Encoding: chunked" to the response (and > > edits the body properly to be in chunked format). > > > > However Unicorn is sending a response with body but without > > "Content-Lentgh" or "Transfer-Encoding", so IMHO it''s incorrect according > > to RFC 2616. > > > > So, should my Rack application handle this stuff? or is it better if I > > let Nginx "fixing" it for me? > > Just load the Rack::ContentLength middleware, if you''re building a Rack > app from scratch. Some frameworks already handle Content-Length for > you.The fact is that to realizing about the above, I already added Content-Length by myself in the Rck application :) Thanks. -- I?aki Baz Castillo <ibc at aliax.net>