Reverse proxy removes Transfer-Encoding: chunked

I’m trying to setup a nginx (1.4.1) reverse proxy to a HornetQ API using
this configuration:

proxy_http_version 1.1;
proxy_set_header Host $host;
upstream app {
server 127.0.0.1:8000;
keepalive 8;
}
server {
listen 0.0.0.0:7000;
server_name localhost;
location / { deny all; }
location = /messaging/ {
proxy_pass http://app/messaging/;
proxy_buffering off;
}
}

After a lot of tcpdumping I see that that nginx removes the
Transfer-Encoding header and sets the Content-Length header in place of
it,
which the length of the first ‘chunk’. After that the connection gets
reset.

When sending the following headers:

POST /messaging/ HTTP/1.1
Host: localhost
Content-Type: application/octet-stream
Transfer-Encoding: chunked
Content-Transfer-Encoding: binary
User-Agent:
org.jboss.netty.channel.socket.http.HttpTunnelingClientSocketChannel

nginx will forward them like:

POST /messaging/ HTTP/1.1
Host: localhost
Content-Length: 60
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
User-Agent:
org.jboss.netty.channel.socket.http.HttpTunnelingClientSocketChannel

Is this normal behaviour?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,243073,243073#msg-243073

Hello!

On Mon, Sep 23, 2013 at 02:34:28PM -0400, Pommi wrote:

listen 0.0.0.0:7000;

which the length of the first ‘chunk’. After that the connection gets
org.jboss.netty.channel.socket.http.HttpTunnelingClientSocketChannel

Is this normal behaviour?

Yes, it’s expected behaviour. Except it uses length of the full
request, not length of the first chunk.


Maxim D.
http://nginx.org/en/donation.html

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs