How can i achive the following with HAProxy with regards to its simple tutorial found here:


I would to use HAProxy first direct all trafic to primary if off direct to secondary if primary back redirect back to primary

Is there also an option to discard some of the requests by the proxy? for example all requests /tothisplace to discard at this HAProxy level?

Also is there anything much simpler than HAProxy that I can use to achieve that? (I used in the past simpleproxy for other usage and it was very easy to use, is there a way to do it with simpleproxy?)


  • why was this message blocked?
    – Jas
    Jul 28, 2011 at 11:14

1 Answer 1


Question 1 - add a backup directive on the secondary server - http://code.google.com/p/haproxy-docs/wiki/ServerOptions

server pri <address>[:port]
server sec <address>[:port] backup

Question 2 - You can create an ACL based on the requested url, using url_end or something like that, and redirect it to an tarpit. http://code.google.com/p/haproxy-docs/wiki/MatchingLayer7

frontend webserver
        bind :80
        option forwardfor
        acl bk_deny url_end /file.ext
        use_backend tarpit if bk_deny
        default_backend default-pool

backend default-pool
        balance ...
        option httpchk ...
        server ...

backend tarpit
        mode http
        # do not hold the connection
        timeout tarpit 1
        # Emulate a 503 error
        errorfile 503 /etc/errors/500_tartarus.txt
        # slowdown any request coming up to here
        reqitarpit .

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .