RabbitMQ behind Apache mod_proxy not resolving deep link

apache-2.2mod-proxyrabbitmq

I have RabbitMQ running behind Apache mod_proxy so I can access the web management interface over port 80:

<VirtualHost *:80>
    ServerName rabbit.example.com

    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
       Order deny,allow
       Allow from all
    </Proxy>

    ProxyPass / http://localhost:15672/
    ProxyPassReverse / http://localhost:15672/

    <Location />
       Order allow,deny
       Allow from all
    </Location>
</VirtualHost>

This seems to work however, when I e.g. go to the Queues page and I click on one of the listed queues I get a Not Found page and a URL that looks something like this:

http://rabbit.example.com/#/queues/%2F/myqueue

The same thing goes for Connections, Channels etc. I only seem to be able to access the top pages but anything deeper seems to result in a Not Found.

What is the correct way to configure RabbitMQ behind Apache mod_proxy?

Best Answer

First you need to stop apache2.4 from decoding slashes in your path (%2F). To do so set

AllowEncodedSlashes NoDecode

And you need to prevent the escaping of 'dangerous' characters like '#'. With mod_rewrite that would be the [NE] flag, with mod_proxy set

nocanon

This results in:

<VirtualHost *:80>
    ServerName rabbit.example.com

    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
       Order deny,allow
       Allow from all
    </Proxy>

    AllowEncodedSlashes NoDecode
    ProxyPass / http://localhost:15672/ nocanon
    ProxyPassReverse / http://localhost:15672/

    <Location />
       Order allow,deny
       Allow from all
    </Location>
</VirtualHost>
Related Topic