Forum: NGINX upstream sent invalid chunked response

D46e056ff0bbdd9b9e67983d1071fdfc?d=identicon&s=25 Wim R. Crols (Guest)
on 2014-02-24 11:53
(Received via mailing list)
Hi,

We are using nginx as a reverse proxy before JBoss and Apache. Certain
POST
requests are failing when passing through nginx.
/var/log/nginx/error.log
showed errors like this:

2014/02/24 10:05:05 [error] 3409#0: *1744 upstream sent invalid chunked
response while reading response header from upstream, client:
10.100.7.100,
server: appliance, request: "POST /archive/python/pulsar/browser/
HTTP/1.1", upstream:
"https://10.100.7.3:443/archive/python/pulsar/browser/",
host: "10.100.7.1"


Doing a little research I understood version 1.2.1 which we used had a
problem with chunked encoding so I upgraded to 1.4.5 (since this is the
official Debian wheezy-backports version). However, the same error
appears.
Do I have to turn something on to make this feature work? I did not find
anything in the documentation (only a config option
'chunked_transfer_encoding' to turn if off, if I understood correctly).

If it is any help, my test with wget (performed from "in front" of nginx
of
course) below produces the above "invalid chunked response" log error
each
time. I confirmed that the request performed from "behind" nginx works.

wcrols@wim:/home/wcrols/downloads/pacstmp$ wget -SO - --post-file
POST.xml
--no-check-certificate https://10.100.7.1/archive/python/pulsar/browser/
--2014-02-24 11:48:00--
https://10.100.7.1/archive/python/pulsar/browser/
Connecting to 10.100.7.1:443... connected.
The certificate's owner does not match hostname `10.100.7.1'
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Server: nginx/1.4.5
  Date: Mon, 24 Feb 2014 10:47:59 GMT
  Content-Type: text/xml
  Transfer-Encoding: chunked
  Connection: keep-alive
  Pragma: no-cache
  Cache-control: no-cache, no-store, must-revalidate, max-age=1,
max-stale=0, post-check=0, pre-check=0, private
  Expires: Mon, 26 Jul 1997 05:00:00 GMT
  Vary: *,Accept-Encoding
  via: HTTP/1.1 apps
Length: unspecified [text/xml]
Saving to: `STDOUT'

    [ <=>

                   ] 0           --.-K/s   in 0s

2014-02-24 11:48:01 (0.00 B/s) - written to stdout [0]


Thank you for your help,
Wim

<http://www.esaturnus.com>
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2014-02-24 12:05
(Received via mailing list)
Hello!

On Mon, Feb 24, 2014 at 11:52:48AM +0100, Wim R. Crols wrote:

> host: "10.100.7.1"
>
>
> Doing a little research I understood version 1.2.1 which we used had a
> problem with chunked encoding so I upgraded to 1.4.5 (since this is the
> official Debian wheezy-backports version). However, the same error appears.
> Do I have to turn something on to make this feature work? I did not find

The message indicate that upstream server returned invalid
response, or at least nginx thinks it is invalid.  If you think
that response returned is valid, it's good idea to actually
provide what was returned, as well as nginx's debug log.

See here for some more hints:

http://wiki.nginx.org/Debugging

> anything in the documentation (only a config option
> 'chunked_transfer_encoding' to turn if off, if I understood correctly).

No, "chunked_transfer_encoding" is to disable use of chunked
transfer encoding with clients by nginx.  The message complains
about what's returned by your backend server.

--
Maxim Dounin
http://nginx.org/
D46e056ff0bbdd9b9e67983d1071fdfc?d=identicon&s=25 Wim R. Crols (Guest)
on 2014-02-24 16:41
(Received via mailing list)
>
> The message indicate that upstream server returned invalid
> response, or at least nginx thinks it is invalid.  If you think
> that response returned is valid, it's good idea to actually
> provide what was returned, as well as nginx's debug log.
>
>
> --
> Maxim Dounin
> http://nginx.org/


Thank you.
You were right. It turned out JBoss (or one of its components) gave a
strange response in HTTP 1.1 chunked transfer... but without chunk
sizes.
I solved it by adding these two directives:

+      proxy_http_version 1.1;
+      proxy_set_header Connection "";
2974d09ac2541e892966b762aad84943?d=identicon&s=25 mehtad (Guest)
on 2014-08-28 19:51
(Received via mailing list)
Did you happen to find any solutions for this? We are experiencing the
same
issue.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,247883,252933#msg-252933
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.