Re: cookie setting in configuration and HTTP/1.1 400 Bad Request

From: Willy Tarreau <w#1wt.eu>
Date: Wed, 4 Feb 2009 07:14:32 +0100


On Tue, Feb 03, 2009 at 05:03:00PM -0800, Hsin, Chih-fan wrote:
> Hi, I have Ecommerce type of web server with dynamic pages that establish session cookie.
>
> If I use the following HAProxy configuration, then the client gets "HTTP/1.1 400 Bad Request " and "Your browser sent a request that this server could not understand."
> Listen proxy1 200.200.1.16:80
> Mode http
> cookie SERVERID insert indirect
> balance roundrobin
> stats enable
> log 127.0.0.1 local0
> timeout client 30s
> timeout server 30s
> timeout connect 5s
> option tcpka
> server webA 200.200.2.18:80 cookie A
>
>
> However, if I use the following configuration, it works fine.
> Listen proxy1 200.200.1.16:80
> Mode http
> balance roundrobin
> stats enable
> log 127.0.0.1 local0
> timeout client 30s
> timeout server 30s
> timeout connect 5s
> option tcpka
> server webA 200.200.2.18:80
>
>
> However, when I have multiple servers, I do want to use cookie in configuration to look for a particular cookie which will contain
> a server identifier which should handle the connection. Can any one suggest the correct cookie setting in configuration file?

I don't get it, your configuration is 100% standard. And the fact that the request is considered invalid should have nothing to do with setting a cookie. What client are you using ? Could you get a tcpdump capture of the exchange between the client and haproxy when the problem happens ? Please use :
  tcpdump -s0 -npi eth0 host 200.200.1.16 and tcp port 80 -w bug.cap

on the haproxy machine, and send me bug.cap after a complete exchange. Also, don't forget to restart your browser in order to ensure it did not maintain any previous cookie.

Regards,
Willy Received on 2009/02/04 07:14

This archive was generated by hypermail 2.2.0 : 2009/02/04 07:30 CET