Hi,

On Sat, Dec 09, 2017 at 03:58:13PM +0000, Aleksandar Lazic wrote:
> Hi.
> 
> ------ Originalnachricht ------
> Von: "Guillaume Lefranc" <[email protected]>
> An: [email protected]
> Gesendet: 09.12.2017 16:01:07
> Betreff: PH error - Capturing all response headers?
> 
> > We are getting occasional PH errors (Premature abort - Header issue) on
> > requests returned by our nginx backends, so in order to debug the issue
> > I would like to capture all the response headers on the affected URI.
> > However, according to HAProxy docs, headers can only be captured by
> > name. Is there a way so I can capture all headers instead of one
> > specifically?
> I have searched also for such a feature.
> I end up to call tcpdump/tshark for this.
> 
> Maybe you can make a small lua script which prints all header into the log.

Well, there's even easier. If you're seeing PH, it means that haproxy
has blocked a response containing invalid headers. In this case it's
*always* captured. So you can simply observe this on the CLI using
"show errors". It will even report the exact position of the first
invalid character that causes the problem, and the date of the last
event.

Guillaume, for this you need to have a stats socket with admin level in
your global section, for example :

   global
       stats socket /var/run/haproxy.sock level admin

Then once you've seen one of these issues in the logs, you can issue :

  $ echo "show errors" | socat - /var/run/haproxy.sock

It only keeps the last error seen in each direction for each proxy, but
often that's enough to iteratively fix the problem (thanks to the date
telling you it hasn't happened in a while).

Willy

Reply via email to