RE: Backend sends 204, haproxy sends 502

From: John Lauro <john.lauro#covenanteyes.com>
Date: Wed, 28 Oct 2009 09:05:20 -0400


You could run mode tcp if you setup haproxy in transparent mode .  

From: Dirk Taggesell [mailto:dirk.taggesell#googlemail.com] Sent: Wednesday, October 28, 2009 9:03 AM To: haproxy#formilux.org
Subject: Backend sends 204, haproxy sends 502  

Hi all,

I want to load balance a new server application that generally sends http code 204 - to save bandwidth and to avoid client-side caching. In fact it only exchanges cookie data, thus no real content is delivered anyway.

When requests are made via haproxy, the backend - as intended - delivers a code 204 but haproxy instead turns it into a code 502. Unfortunately I cannot use tcp mode because the server app needs the client's IP address. Is there something else I can do?

Request directly to the appserver:

bash-3.2$ curl --verbose "http://cm01.example.com:8000/c"

* About to connect() to cm01.example.com port 8000 (#0)
*   Trying 22.33.44.55... connected
* Connected to cm01.example.com (22.33.44.55) port 8000 (#0)

> > GET /c HTTP/1.1
> > User-Agent: curl/7.19.6 (i386-apple-darwin9.8.0) libcurl/7.19.6
OpenSSL/0.9.8k zlib/1.2.3
> > Host: cm01.example.com:8000
> > Accept: */*
> >
< HTTP/1.1 204 No Content
< Date: Wed, 28 Oct 2009 11:56:44 GMT
< Server: Jetty/5.1.11RC0 (Linux/2.6.21.7-2.fc8xen amd64 java/1.6.0_16
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Set-Cookie: pid=08f0b764185;Path=/;Domain=.example.com;Expires=Thu,
16-Oct-59 11:56:44 GMT
< Connection: close
<
* Closing connection #0

The above is how it is intended to look. And now via haproxy:

bash-3.2$ curl --verbose "http://cm01.example.com/c"

* About to connect() to cm01.example.com port 80 (#0)
*   Trying 22.33.44.55... connected
* Connected to cm01.example.com (22.33.44.55) port 80 (#0)

> > GET /c HTTP/1.1
> > User-Agent: curl/7.19.6 (i386-apple-darwin9.8.0) libcurl/7.19.6
OpenSSL/0.9.8k zlib/1.2.3
> > Host: cm01.example.com
> > Accept: */*
> >

* HTTP 1.0, assume close after body
< HTTP/1.0 502 Bad Gateway
< Cache-Control: no-cache
< Connection: close
< Content-Type: text/html
<
<html><body><h1>502 Bad Gateway</h1>

The server returned an invalid or incomplete response. </body></html>
* Closing connection #0

No virus found in this incoming message. Checked by AVG - www.avg.com
Version: 8.5.423 / Virus Database: 270.14.29/2455 - Release Date: 10/28/09 09:34:00 Received on 2009/10/28 14:05

This archive was generated by hypermail 2.2.0 : 2009/10/28 14:15 CET