HAProxy community

Disable haproxy converting responses with content-length header to chunked transfer-encoding

We are noticing haproxy sometimes converts responses with content-length headers to responses with chunked transfer-encoding and no content length headers. Is it possible to disable this behavior and always have haproxy respect the backend response headers?

Example: request to backend directly

$ curl http://localhost:8080/content.js
...
< HTTP/1.1 200 OK
< Content-Type: application/javascript
< Content-Length: 1234567
...

Example: request to via haproxy (note content-length header is dropped and transfer-encoding is introduced)

$ curl http://localhost:9090/some.js
...
< HTTP/1.1 200 OK
< content-type: application/javascript
< transfer-encoding: chunked
...

Our tuning parameters in haproxy.cfg:

tune.maxrewrite 32768
tune.bufsize 65536

I doubt haproxy will do that by default.

Please share the entire headers, the entire configuration as well as the output of haproxy -vv.

You probably have some feature enabled that transform the payload, like compression.

Okay, will do.

I was unable to quickly reproduce this with a simple Python server. My actual server is a Jetty server, I will debug the Jetty server further and see if Jetty is responsible here. I’ll update this issue with my findings.

I confirmed that the chunked to non-chunked conversion is happening at my Jetty server/client. Sorry for the invalid request.

1 Like