Re: modifing default haproxy emit codes

2014-04-02 Thread Patrick Hemmer
You want the errorfile config param.
http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#errorfile

-Patrick



*From: *Piavlo lolitus...@gmail.com
*Sent: * 2014-04-02 15:16:22 E
*To: *haproxy@formilux.org
*Subject: *modifing default haproxy emit codes

  Hi,

 According to the docs:

 Haproxy may emit the following status codes by itself :
503  when no server was available to handle the request, or in
 response to
 monitoring requests which match the monitor fail condition
504  when the response timeout strikes before the server responds

 Instead what I need is that if no server is available for or if server
 does not send and http response within a defined timeout is that
 haproxy respond with 204. Is it possible?
 I assume I can define fallback backend that will redispatch the
 requests to a dumb http server that always answers with 204? Instead
 it would be much better if haproxy itself could reply with 204.

 tnx




Re: modifing default haproxy emit codes

2014-04-02 Thread Baptiste
Hi,

You can use the errorfile directive with a fake 204 status code in the
HTTP file to use as an answer.
Check the doc and come back here if you did not manage to configure it.

Baptiste


On Wed, Apr 2, 2014 at 9:16 PM, Piavlo lolitus...@gmail.com wrote:
  Hi,

 According to the docs:

 Haproxy may emit the following status codes by itself :
503  when no server was available to handle the request, or in response
 to
 monitoring requests which match the monitor fail condition
504  when the response timeout strikes before the server responds

 Instead what I need is that if no server is available for or if server does
 not send and http response within a defined timeout is that haproxy respond
 with 204. Is it possible?
 I assume I can define fallback backend that will redispatch the requests to
 a dumb http server that always answers with 204? Instead it would be much
 better if haproxy itself could reply with 204.

 tnx




Re: modifing default haproxy emit codes

2014-04-02 Thread Piavlo


 Hi Baptiste ,

So if i need webserver to respond within 50ms and if not haproxy should 
reply with 204 i need:


timeout server 50ms
errorfile 504   /etc/haproxy/errors/204.http

where /etc/haproxy/errors/204.http would be a 204 response with no body?

What is the exact action for haproxy to the server side which had timed 
out, does it just send a TCP close packet?


Also if this happens on a keepalive connection and i want haproxy to 
send 204 without closing connection to the client
and at the same time throwing away  the late reply from the server once 
it arrives and not closing the connection to server
so that client could continue sending new http requests on this 
keepalive connection.
Why I need this crazy stuff? :) Because this a realtime bidding 
environment, and I need haproxy to reply with nobid (204) response,
then webserver bidder is taking too long (would happen during GC mostly 
as the bidder web servers are running on JVM)
and if haproxy could also keep the keepalive connection alive that would 
be just perfect.


tnx

Alex


On 04/02/2014 10:20 PM, Baptiste wrote:

Hi,

You can use the errorfile directive with a fake 204 status code in the
HTTP file to use as an answer.
Check the doc and come back here if you did not manage to configure it.

Baptiste


On Wed, Apr 2, 2014 at 9:16 PM, Piavlo lolitus...@gmail.com wrote:

  Hi,

According to the docs:

Haproxy may emit the following status codes by itself :
503  when no server was available to handle the request, or in response
to
 monitoring requests which match the monitor fail condition
504  when the response timeout strikes before the server responds

Instead what I need is that if no server is available for or if server does
not send and http response within a defined timeout is that haproxy respond
with 204. Is it possible?
I assume I can define fallback backend that will redispatch the requests to
a dumb http server that always answers with 204? Instead it would be much
better if haproxy itself could reply with 204.

tnx