Alex Zhukovskiy
Alex Zhukovskiy

Reputation: 10015

Connect to RabbitMQ via URL

I'm trying to connect to the rabbitmq which is hidden behind nginx proxy. It's declared as:

   location ^~ /rabbitmq/ {
      proxy_pass http://127.0.0.1:5672/;
   }

The problem is that as I found AMPQ only specifies host but it doesn't know anything about urls.

Can I connect rabbit client to www.myserver.com/rabbitmq somehow? I'm using EasyNetQ to connect, but it looks like a protocol limitation, and implementation doesn't matter.

If it's not possible at all maybe there are some workarounds?

Upvotes: 0

Views: 4334

Answers (1)

nbari
nbari

Reputation: 26905

For AMQP, If using Nginx probably doing a TCP load balancing could help: https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/, otherwise if you could use HAProxy you could try something like this:

frontend rabbitmq
    mode tcp
    bind *:5672
    use_backend bunny 

backend bunny
    mode tcp
    server bunny 127.0.0.1:5672 check

If you want to publish message over HTTP probably you would like to expose the rabbitmq API:

http://localhost:15672/api/index.html

Notice the port 15672, from the docs:

Note that the UI and HTTP API port — typically 15672 — does not support AMQP 0-9-1, AMQP 1.0, STOMP or MQTT connections. Separate ports should be used by those clients.

Upvotes: 2

Related Questions