0

I have a rabbitMQ server behind a haproxy server. And all the clients are connected through HAproxy to the RabbitMQ and using TCP.

The challenge is when the rabbitMQ connection shows all the connections are coming from same ip of Haproxy server.

How can I get the client ip gets passed through the HAproxy?

I tried bind with transparent, send-proxy, send-proxy-v2 options in haproxy config.

Still I couldnt get the client ip gets passed to the RMQ server. Any thoughts?

Marco
  • 1,709
  • 3
  • 17
  • 31
Gigi
  • 1
  • 1

1 Answers1

0

You cannot change anything on haproxy or RabbitMQ to get the client information. As far as the RabbitMQ is concerned, the connection really came from haproxy. But you can change the client connecting to provide information about himself.

According to this GitHub issue, you can use something like this:

var amqp = require('amqplib');
amqp.connect('amqp://localhost', {clientProperties: {'IP': '10.0.0.3'}}).then(...);

Depending on your lib/client, it may be called client-properties, client_properties or clientproperties.

By setting clientProperties, if you look at the connection list or use rabbitmqctl list_connections client_properties, the real IP will show up.

ThoriumBR
  • 5,302
  • 2
  • 24
  • 34