6

I am stuffing haproxy in front of 3 riak nodes with HTTP. I want the backend name and/or ip in the response headers. Something like:

X-Proxy-Backend: riak-1 10.0.0.1

or whatever.

How can I make this happen?

Daniel Huckstep
  • 539
  • 2
  • 8
  • 19

2 Answers2

5

You can use the cookie function to add the serverid into your response. For example:

cookie SERVERID insert indirect
server webA 192.168.1.11:80 cookie A check

This will insert a cookie called SERVERID=A into the HTTP headers.

Coops
  • 6,055
  • 1
  • 34
  • 54
0

If you want a header, you can use the srv_id ACL like so:

rspadd X-Backend-Server:\ server1 if { srv_id 1 }
rspadd X-Backend-Server:\ server2 if { srv_id 2 }

You'll have to keep it in sync when you add/remove backend servers, but it works.

bradvido
  • 121
  • 6