Hi,

On Thu, Jan 07, 2010 at 04:20:24PM -0500, Hector Danniel Paz Trillo wrote:
> Hi,
> 
> I have this configuration haproxy -> nginx (static) -> apache (php) .
> It is working fine for large traffic sites. These days I'm adding a
> new site and I starting to see 502 errors when saving a form with POST
> method. The errors were from nginx so I change the header size limit
> to a higher value. The problem was solved for nginx but now I have 502
> errors from haproxy. I think I need to increase the BUFSIZE value in
> the source files of haproxy. But I have some doubts.
> To test I put apache directly behind of haproxy and decrease the
> apache limits for size headers to 4k and apache started to throw 502
> errors. When I increase the value to the default again haproxy is
> getting 502 errors.
> 
> So, the solution seems obvious (increase the BUFSIZE value) but I
> wonder why apache accept the headers with 8k and haproxy doesn't.

By default, haproxy accepts up to half BUFSIZE, and leaves the other
half free for rewriting / header additions. You can change the reserved
space by setting MAXREWRITE. I'm used to build with BUFSIZE at 8kB and 
MAXREWRITE at 1kB so that leaves me with 7kB for headers (which is
already huge).

> Also, how can I know which is the size of the headers?

BUFSIZE - MAXREWRITE. When you get a 502, you may also be able to
get a complete capture of the faulty request and check it using
socat on the stats socket. For this, run :

   echo show errors |  socat stdio unix-connect:<path-to-socket>

> Maybe I can
> avoid compile haproxy and try to decrease the headers size from the
> application.

This is possible only in 1.4-dev, you can define the limit in the
global section (I don't have the tunable in mind, but it's in the
doc). In 1.3 you have to recompile.

Be careful with large headers, there are many equipments which don't
accept them or which partially fail on them. Also, large cookies are
painful for users because they have to emit them for all requests,
which can make them upload megs of data for a few tens of objects.

Regards,
Willy


Reply via email to