Is it possible for haproxy to connect to backend server specified in an http header

From: Delta Yeh <delta.yeh#gmail.com>
Date: Sat, 2 Apr 2011 00:24:14 +0800


Hi all,
 When setting up a web hosting service with haproxy, there is a requirement. The case is :
client----nginx-------haproxy---------------wwws

client :1.1.1.1

nginx  2.2.2.1
haorxy:2.2.2.2
wwws:3.3.3.1

nginx sit between client and haproxy, haproxy work in transparnt mode.

client send request to www.abc.com( 3.3.3.1) ,the request is redirect to nginx box.
nginx get the original server 3.3.3.1 and add a header x-original-to:3.3.3.1 , nginx proxy request to haproxy, haproxy proxy request to the original www server 3.3.3.1 specified in http header "x-original-to"

the config fragment of haproxy may like:

backend wwws

        mode http
        server  virtual-host-server  0.0.0.0 addr_header x-original-to
        source 0.0.0.0 usesrc hdr_ip(x-forwarded-for,-1)


so server option "addr_header x-original-to" tell haproxy the real www server address to be connected to is specified in header "x-original-to"

So my question is it possible for haproxy to do this?

BR,
DeltaY Received on 2011/04/01 18:24

This archive was generated by hypermail 2.2.0 : 2011/04/01 18:30 CEST