Hello Jean-Michel,

On Wed, May 18, 2011 at 12:28:20AM +0100, Mouny Jean michel wrote:
> Hello,
> I have following configuration installed:   
> 
> 
>                                                                      +--   
> backend 1
> 
> Internet  ---- Reverse Proxy with Haproxy      |
>                                                                        +--  
> backend 2
> 
> 
> 
> For each backend, I have a specific cookie (SERVERID) set. These backends are 
> monitored by loadling a picture (gif file) using HTTP protocol. Sometime, for 
> maintenance reasons, I rename the gif file (to bring the backend down in 
> Haproxy). Then, I perform some maintenance tasks. Before bringing backend UP 
> (set gif file name to its original value), I would like to know if it is 
> possible to check health of this specific backend thru reverse proxy. This is 
> to avoid issues for end users who are on Internet.
> 
> Thank you for any tips or response that might be helpfull.

Yes you can do that using the "force-persist" statement. The principle
is that you define with ACLs how to detect that an incoming request is
in fact one of your tests. That could be an IP address, a user-agent,
or a cookie for example. Many people like the cookie because you already
need to force one for the persistence, so if you can force one, you can
force a second one. When this rule is matched, then haproxy will send
your request to the server associated with the persistence cookie,
whatever its state, and will not redispatch the request in case of
failure. This statement was created exactly for the need you describe
here.

So let's consider the following setup :

     listen pub
        bind :80
        cookie SRV
        server srv1 1.1.1.1:80 cookie s1
        server srv2 1.1.1.2:80 cookie s2
        acl its_me hdr_sub(cookie) TEST=true
        force-persist if its_me

Then you configure your browser to send two cookies :

  SRV=srv1
  TEST=true

and you send any request you want there. You'll always be sent
to server1.

Cheers,
Willy


Reply via email to