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?


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': ''}}).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.

  • you need to use haproxy tproxy – c4f4t0r Oct 23 '17 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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