Thursday, May 28, 2020

RabbitMQ proxied through apache httpd web server

Problem

RabbitMQ wasn't allowing us to add exchanges through the web console. Clicking on the button resulted in the PUT request being sent to apache, but apache wasn't forwarding the traffic onto rabbitMQ.

This was confirmed by checking the apache logs. Indeed the request was received, but in the rabbitMQ logs, there was no change in activity. This would a suggest a problem at the apache level.

At the browser level, debugging shows a 404 status code was returned, which suggests that apache wasn't able to find handler for the request.

Solution


Reference: https://serverfault.com/questions/639327/rabbitmq-behind-apache-mod-proxy-not-resolving-deep-link

Modify your httpd.conf or ssl.conf to have the following
Edit /etc/rabbitmq/rabbitmq.conf and add
 management.path_prefix = /mq  


Edit /etc/httpd/conf.d/ssl.conf and add the following rules:
   AllowEncodedSlashes NoDecode  
   ProxyPass /mq http://localhost:15672/mq nocanon  
   ProxyPassReverse /mq http://localhost:15672/mq  

It's important to note that a trailing slash is required when entering the URL path in the browser. For example:

https://myhost/mq/