emqx/emqx-dashboard

how to set dashboard base url?

Closed this issue · 5 comments

We wanna visit emqx dashboard by url http://mydomain.com/emqadmin, how to set base url?

Hi, @andares The EMQX don't care about the base URL. You can hang up a Proxy server in front of EMQX (For example Ngnix).

but I try to do it, the resource load request is all be 404.

图片

图片

图片

the path is not append in url head.

my nginx proxy config:

    location ^~/emqadmin/ {
        proxy_pass              http://channel:18083/;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        Host $http_host;
    }

    location ^~/rmqadmin/ {
        proxy_pass              http://bus:15672/;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        Host $http_host;
    }

    location ^~/kadmin/ {
        proxy_pass              http://kadmin:1337/;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        Host $http_host;
    }

I have other web admin service, it's working fine. 😹

You also need to proxy static resource dependencies and the Dashboard API, just like this

location ^~/emqadmin/ {
        proxy_pass              http://channel:18083/;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        Host $http_host;
    }
location ^~/static/ {
        proxy_pass              http://channel:18083/static/;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        Host $http_host;
    }
location ^~/api/v3/ {
        proxy_pass              http://channel:18083/api/v3;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        Host $http_host;
    }

@andares This issue is resolved. I am going to close this issue. Please feel free to re-open if you still have the same trouble.

I don't think so that the question is resolved. It's not "don't care about the base URL", it is "not support base url". As my example, nginx proxy point to rabbitmq admin and kong admin, they are working in the same domain, and the domain may be use for other app.

The rabbitmq admin is real "don't care about base url", it no need more setting. And kong admin can set a base url, and it's working fine too.

If I should proxy every resource for emq dashboard, that's not as good as use a separate domain. 😹