Nginx as reverse proxy, returns garbage symbols

Hi everyone,
I am trying to use nginx as a reverse proxy and I am getting garbage
symbols
in my json responses:

6a
{“codedField”:[{“code”:“01”,“name”:“Dpto01”},{“code”:“02”,“name”:“Dpto02”},{“code”:“03”,“name”:“Dpto03”}]}
0

I have tried with and without gzip and happens the same.

My backend responses are well formed json and then I think that it
should be
a nginx issue.

Can anybody help me please ?

Regards,

Camilo Aguilar


There are two ways of constructing a software design: One way is to
make
it so simple that there are obviously no deficiencies, and the other way
is
to make it so complicated that there are no obvious deficiencies. The
first
method is far more difficult. -C. A. R. Hoare

Any fool can write code that a computer can understand. Good
programmers
write code that humans can understand. - Martin F.

This is my nginx configuration: gist:192103 · GitHub

On Wed, Sep 23, 2009 at 11:45 AM, Camilo Aguilar
[email protected]wrote:

I have tried with and without gzip and happens the same.

write code that humans can understand. - Martin F.


There are two ways of constructing a software design: One way is to
make
it so simple that there are obviously no deficiencies, and the other way
is
to make it so complicated that there are no obvious deficiencies. The
first
method is far more difficult. -C. A. R. Hoare

Any fool can write code that a computer can understand. Good
programmers
write code that humans can understand. - Martin F.

it means that I should not apply this patch:
http://www.ruby-forum.com/attachment/1891/patch.chunkedfrom:
http://www.ruby-forum.com/topic/152435
??

Regards,

Camilo Aguilar

On Wed, Sep 23, 2009 at 12:01 PM, Maxim D. [email protected]
wrote:

Looks like your backend returns Transfer-Encoding: chunked to

Regards,
it so simple that there are obviously no deficiencies, and the other way
is
to make it so complicated that there are no obvious deficiencies. The
first
method is far more difficult. -C. A. R. Hoare

Any fool can write code that a computer can understand. Good
programmers
write code that humans can understand. - Martin F.


There are two ways of constructing a software design: One way is to
make
it so simple that there are obviously no deficiencies, and the other way
is
to make it so complicated that there are no obvious deficiencies. The
first
method is far more difficult. -C. A. R. Hoare

Any fool can write code that a computer can understand. Good
programmers
write code that humans can understand. - Martin F.

Hello!

On Wed, Sep 23, 2009 at 11:45:09AM -0500, Camilo Aguilar wrote:

My backend responses are well formed json and then I think that it should be
a nginx issue.

Looks like your backend returns Transfer-Encoding: chunked to
HTTP/1.0 requests (behaviour explicitly forbidden by RFC2616).

Fixing backend should help.

Maxim D.

Hello!

On Wed, Sep 23, 2009 at 12:16:13PM -0500, Camilo Aguilar wrote:

it means that I should not apply this patch:
http://www.ruby-forum.com/attachment/1891/patch.chunkedfrom:
Nginx adds extra chunked header while proxying anytermd - NGINX - Ruby-Forum
??

This patch was considered to be wrong as it potentially introduce
much more problems than it solves. E.g. strange things will happen
if any content filtering within nginx will be used (gzip, ssi,
addition or sub filters and so on).

It may work in your particular case, but I don’t recommend it.
Fixing backend instead is much more correct and safe aproach.

Maxim D.

Thanks Maxim for your quick answer,
Do yo know something about nginx talking to backends in http 1.1 ?

On Wed, Sep 23, 2009 at 12:46 PM, Maxim D. [email protected]
wrote:

much more problems than it solves. E.g. strange things will happen

Camilo Aguilar
is

programmers

write code that humans can understand. - Martin F.


There are two ways of constructing a software design: One way is to
make
it so simple that there are obviously no deficiencies, and the other way
is
to make it so complicated that there are no obvious deficiencies. The
first
method is far more difficult. -C. A. R. Hoare

Any fool can write code that a computer can understand. Good
programmers
write code that humans can understand. - Martin F.