Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I ran into this post which shows my problem EXACTLY

BUT browsers are using http 1.1 these days so I really don't understand. Our backend is the playframework and I don't mind fixing it but I don't really understand what is not working ESPECIALLY since firefox, safari, chrome ALL download the response just fine with no problems. ONLY when we stick NGINX in the middle do things break and we end up with extra data in our json responses.

Any idea how to fix this? as the doc above just seems wrong since we are now on later versions of http PLUS the browsers seem to work just fine.

thanks, Dean

share|improve this question

When your setup looks like browser -> nginx -> backend, it more or less irrelevant what browser is able to handle when we are talking about connection between nginx and backend.

The protocol nginx uses to talk to backends by default is HTTP/1.0, and use of chunked encoding is explicitly forbidden by RFC 2616:

A server MUST NOT send transfer-codings to an HTTP/1.0 client.

If your backend returns chunked responses to HTTP/1.0 requests - it does wrong thing and needs fixing, regardless of the fact whether you see the problem in a browser or not. Common result is that chunk-size strings (hex numbers like 47 in the FAQ) are interpreted as a part of response body by various HTTP/1.0 clients.

In case of (old versions of) nginx what used to happen is that while passing data to a browser (which talks HTTP/1.1 and hence undersand chunked) nginx added it's own chunked encoding on top of incorrect body with chunk-size strings embedded. As a result browsers used to see the response body in a way nginx did.

From the above it should be clear enough that there is only one correct way to solve the problem - fix the backend. On the other hand, with newer nginx versions (1.1.4+) you shouldn't see the problem as outlined in the FAQ. If you see - this means that either your assumption about nginx version used is wrong, or you aren't using proxy_pass (but some other backend module?), or you have more than one problem. Using nginx debug log might help to find out what's going on here. Or you may start with fixing the backend (which is right thing to do anyway).

share|improve this answer
No, I have to have chunking working through the nginx. I upgraded nginx which fixed the issue. We have a certain url that is hardcoded to do chunking...this cannot change. anyways upgrading nginx fixed the issue. – Dean Hiller Dec 21 '12 at 14:14
up vote 0 down vote accepted

upgrading nginx fixed the issue. There is a url that is hardcoded for chunking so I have to have an LB that can do chunking. There is no way around that. We stream sometimes gigabytes of research data down using chunking. We have to have http 1.1 chunking working.

Anyways, upgrade nginx if you ran into this issue and it fixes reason to touch the backend at this point since all browsers are now working and everything seems fine.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.