To some URL I don't want use some server. So use other.

Actually I have this haproxy configuration.

global                                                                                                                                                                             
        daemon
        log 127.0.0.1   local0
        #log loghost    local0 info
        maxconn 4096
        #debug
        #quiet
        user haproxy
        group haproxy

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        option redispatch
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000
        balance roundrobin

        stats enable
        stats refresh 5s
        stats auth admin:123abc789xyz


# Set up application listeners here.
listen application 0.0.0.0:10000
  server localhost 127.0.0.1:10100 weight 1 maxconn 5 check
  server externe 127.0.0.1:10101 weight 1 maxconn 5 check

By example I want all url to /users be served only by server localhost, not by externe.

link|improve this question
feedback

2 Answers

up vote 1 down vote accepted

We did something similar on our servers. What we did was first to set up a frontend proxy, which using HAProxy's ACL allows to use one or another backend. In your example it could be something like the following:

frontend application
  bind 0.0.0.0:10000

  acl use_localhost path_reg ^/users$

  use_backend localhost if use_localhost

  default_backend externe

backend localhost
  server localhost 127.0.0.1:10100 weight 1 maxconn 5 check

backenb externe
  server externe 127.0.0.1:10101 weight 1 maxconn 5 check

In the example *use_localhost* is the name of the ACL. You can use plenty of different ACLs. I hope this gives you something to start with.

link|improve this answer
thanks, it's exactly what I want. – shingara Nov 20 '10 at 7:55
feedback

What if i have 2 different web server, and i want use one or another depending on the url?

http://127.0.0.1:80/site1/

http://127.0.0.1:80/site2/

but every server have to receive the header GET / and not GET /site1/ or GET /site2/

EDIT: Solved with nginx

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.