rabbitmq proxy_pass while using nginx on docker

60 Views Asked by At

I'm having a bit of a problem with nginx while using proxy_pass My infra is as following There is Kubernetes service hosted on AWS and i use ALB ingress controller. there are like 10 application at this moment deployed and running fine on ec2 instance i have installed RabbitMQ that is ONLY available under private subnet. Since i use Datadog to monitor queues and Devs needs to have availability of the portal to check their queues

The point of the problem is as following I`m running with nginx in the middle between ALB Ingress controller and RabbitMQ to expose the management console

All is running fine with my proxy_pass only until i need to access specific queue and thats because the vhost of rabbitmq is "/"

the URL on nginx that is https://DOMAIN:15672/path/#/queues/%2F/DataChanges and this is the configuration under nginx

location /path/{
                proxy_pass http://rabbitmq1.dev.internal:15672/;
        }

Respond for this config is Status Code: 404 Not Found RabbitMQ

i tried different config like suggested on the documentation to use the proxy_pass without a slash at the end but in that case i cannot access the management console and the error is shown as below

location /path/{
                proxy_pass http://rabbitmq1.dev.internal:15672;
        }

Log inside docker for nginx

10.0.25.87 - - [12/Feb/2024:09:46:54 +0000] "GET /l2v/ HTTP/1.1" 404 49 "-"

Browser respond

{"error":"Object Not Found","reason":"Not Found"}

Could you help me out and point me to the potential solution or i should change the nginx to different proxy?

I build the dockerimage simple as following

FROM nginx:latest

COPY default.conf /etc/nginx/conf.d/default.conf
1

There are 1 best solutions below

1
CodeNebulaWizard On

You could try the following:

Above the proxy pass line in the nginx config, insert this:

    rewrite ^/path(.*)$ $1 break;

It should remove the /path segment of the url which may be confusing the rabbitmq service

Please let me know if this helps