i use nginx 1.1.0 as balancer in front of some apache-server. In some
cases, where the apache is generating bigger pages it sends content as
chunked, nginx is adding a second “chunked” to http-response header.
This is confusing Browsers and looks like:
Currently Nginx does not support chunked responses from backend servers.
There is a patch available in the dev forum/mailing list,however it is
still considered experimental and you’ll have to apply it to the source
yourself.
If you do not want to do this then you must force Apache to never return
chunked responses, that’s the only way this will work.
What can id do to avoid this double chunked in header? Parts of conf
needed? ( no special stuff in it)
There are two basic options:
Fix backend to actually complain to HTTP specification (i.e.
do not send chunked responses to HTTP/1.0 requests). You may try
SetEnv downgrade-1.0
in Apache config. Alternatively, grep your php scripts for things like
header("HTTP/1.1 ...");
and change them to be “HTTP/1.0 …” (the problematic Apache
behaviour is caused by PHP module which sets r->proto_num to 1.1
if script uses header(“HTTP/1.1 …”), it should never ever do
that).
Try patch which adds HTTP/1.1 support in nginx proxy module,
see here:
With the patch nginx understands chunked from http backends and
everything should be fine even if backend sends chunked over
HTTP/1.0 (you just need to compile with patch, no further actions
related to keepalive upstream connections required).
Maxim D.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.