Hi Lyle,

Le 03/02/2012 20:37, Lyle Underwood a écrit :
Hello list,

I've been using haproxy for simple routing in front of two unicorn
servers for a while now, including reqrep, and it's worked just fine
on multiple boxes. Recently I tried to setup a third backend which
pointed at an apache stack. It works sort of, the only problem is that
reqrep only seems to work on that backend for some small percentage of
the requests. It feels random. I think it's possible it could have
some relation to the browser cache, but it's really difficult to hone
in on. I've confirmed by watching the apache logs that some requests
are being rewritten and some are not.

https://gist.github.com/ea2dd27507e5e3ec3318

By default, haproxy works in tunnel mode, which means that only the first request of a connection is parsed, anything after the first request headers is considered as data. When HTTP Keep-Alive is used between the client to the server, you'll have several requests in the same connection, which will be interpreted as data only (then not parsed nor modified by reqrep and others).

For your needs, you have to change that mode by using "option httpclose" (prevents HTTP Keep-Alive) or "option http-server-close". The latter is oftenly better : you still have HTTP Keep-Alive enabled between the client and haproxy, and haproxy will parse every requests of the same connections.

Important thing, don't forget to add a http-keep-alive timeout when using option http-server-close.

marketing-files-backend is the one in question.

So my questions are:

1. Does anybody have any experience with this problem?

2. Does reqrep apply to the entire request? Does it stop at the first
match?

3. My haproxy logfile seems to have a significant delay. Is this normal?

Using one of those 2 options will solve each question ;-)


Thanks for your time,
Lyle

--
Cyril Bonté

Reply via email to