RabbitMQ management - 404 when loading a queue or exchange
Asked Answered
O

4

6

I have installed RabbitMQ to my Kubernetes Cluster via Google Cloud Platform's marketplace.

I can connect to it fine in my other applications hosted in the Kubernetes Cluster, I can create queues and setup consumers from them without any problems too.

I can temporarily port forward port 15672 so that I can access the management user interface from my machine. I can login fine and I get a list of queues and exchanges when visiting their pages. But as soon as I select a queue or an exchange to load that specific item, I get a 404 response and the following message. I get them same when trying to add a new queue.

Not found
The object you clicked on was not found; it may have been deleted on the server.

They definitely exist, because when I go back to the listing page, they're there. It's really frustrating as it would be nice to test my microservices by simply publishing a message to a queue using RabbitMQ management, but I'm currently blocked from doing so!

Any help would be appreciated, thanks!

Edit
A screenshot provided for clarity (after clicking the queue in the list): rabbitmq admin

If I try to add a new queue, I don't get that message, instead I get a 405.

Ora answered 15/2, 2019 at 10:41 Comment(9)
When you say "port forward" do you mean from a container or through a proxy? I would be very curious to know what is shown by the "Network" trace dev tool in your web browser.Rarotonga
Can you provide screenshots perhaps?Atchley
@LukeBakken I'm using gcloud console and running kubectl port-forward -etc.Ora
@AhmetB-Google I've added a screenshot nowOra
@AhmetB-Google it's easily reproducible. If you go to the GCP MarketPlace, configure RabbitMQ for Kubernetes, then go to Kubernetes Engine / Services / RabbitMQName-svc, then click Port Forwarding on port 15672. Open the link generated, then try either selecting a queue / exchange or adding a new queue / exchange.Ora
@ThePower I have got the same issue. I configured RMQ server in ubuntu 16.04. RMQ admin portal is working fine . after proxy pass with 15672, the above error is throwing. Any suggestions with sample proxy.Koffler
@LloydPowell Have you solved the issue?Aeneid
@KoopaKiller I didn't directly, but I've since decided that anything that needs to persist in any shape or form that I would run it outside of my kubernetes cluster. So that's how I resolved that one. Sorry if that answer isn't so great, but it lead me to a change in architectural decision making and to consider service bus the same as I do with databases and storage.Ora
@LloydPowell I totally understand your decision. I will try to play around with it and if I find something I'll here. Thanks for answer!Aeneid
C
5

This is because the default virtual-host is '/'. RabbitMQ admin uses this in the URL when you access the exchanges/queues pages. URL encoded it becomes '%2F'. However, the Ingress Controller (in my case nginx) converts that back to '/' so the admin app can't find that URL (hence the 404).

The work-around I came up with was to change the default_vhost setting in rabbitmq to something without '/' in it (e.g. 'vhost').

In the bitnami rabbitmq Helm chart I'm using, this is configured using:

rabbitmq:
  extraConfiguration: |-
    default_vhost = vhost

You do have to update your clients to explicitly specify this new virtual-host though as they generally default to using '/'. In Spring Boot this is as simple as adding:

spring:
  rabbitmq:
    virtual-host: vhost
Capuano answered 3/2, 2022 at 13:56 Comment(0)
E
3

I had the same problem as you this morning, and I fix it by using the bellow configuration:

server {
    listen 80;
    server_name rabbitmq.o2c.ovh;
    access_log acces.log;
    error_log error.log;
    location / {
        client_body_buffer_size 128k;
        proxy_send_timeout   90;
        proxy_read_timeout   90;
        proxy_buffer_size    4k;
        proxy_buffers     16 32k;
        proxy_busy_buffers_size 64k;
        proxy_temp_file_write_size 64k;
        proxy_connect_timeout 30s;
        proxy_pass   http://localhost:15672;
        proxy_set_header   Host   $host;
        proxy_set_header   X-Real-IP  $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
Eno answered 14/5, 2019 at 8:34 Comment(0)
K
0

Check with internal URL it should work as expected, otherwise your definitions.json will be not reachable by your .yml file.

Kwon answered 28/9, 2021 at 12:29 Comment(0)
U
0

For me, this was solution:

    location /rabbitmq/api/ {
        rewrite ^ $request_uri;
        rewrite ^/rabbitmq/api/(.*) /api/$1 break;
        return 400;
        proxy_pass http://rabbitmq-test.rabbitmq-test.svc.cluster.local:15672$uri;
    }

    location /rabbitmq/ {
        rewrite ^/rabbitmq$ /rabbitmq/ permanent;
        rewrite ^/rabbitmq/(.*)$ /$1 break;
        proxy_pass http://rabbitmq-test.rabbitmq-test.svc.cluster.local:15672;
        proxy_buffering                    off;
        proxy_set_header Host              $http_host;
        proxy_set_header X-Real-IP         $remote_addr;
        proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
Unwary answered 30/8 at 9:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.