From: Nick Erdmann Date: Mon, 21 Aug 2017 17:21:10 +0000 (+0000) Subject: pybind/mgr/dashboard: add url_prefix X-Git-Tag: v13.0.1~1125^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6d285fff0df598d66f46d38bf0a6a2cc9c0dc62f;p=ceph.git pybind/mgr/dashboard: add url_prefix This adds a configuration variable url_prefix to the dashboard that that is prepended to all URLs so you can access the dashboard at http://$IP:$PORT/$PREFIX/. This is necessary if you wish to use a reverse http proxy that forwards to the dashboard under a sub-path. Fixes: http://tracker.ceph.com/issues/20568 Signed-off-by: Nick Erdmann --- diff --git a/doc/mgr/dashboard.rst b/doc/mgr/dashboard.rst index 8908497003d..4c2116b133e 100644 --- a/doc/mgr/dashboard.rst +++ b/doc/mgr/dashboard.rst @@ -39,6 +39,13 @@ If the port is not configured, the web app will bind to port ``7000``. If the address it not configured, the web app will bind to ``::``, which corresponds to all available IPv4 and IPv6 addresses. +You can configure a prefix for all URLs:: + + ceph config-key set mgr/dashboard/url_prefix $PREFIX + +so you can access the dashboard at ``http://$IP:$PORT/$PREFIX/``. + + Load balancer ------------- @@ -48,4 +55,5 @@ manager is active (e.g., ``ceph mgr dump``). In order to make the dashboard available via a consistent URL regardless of which manager daemon is currently active, you may want to set up a load balancer front-end to direct traffic to whichever manager endpoint is -available. +available. If you use a reverse http proxy that forwards a subpath to +the dashboard, you need to configure ``url_prefix`` (see above). diff --git a/src/pybind/mgr/dashboard/base.html b/src/pybind/mgr/dashboard/base.html index 1d4947c26de..f21145ac814 100644 --- a/src/pybind/mgr/dashboard/base.html +++ b/src/pybind/mgr/dashboard/base.html @@ -9,27 +9,27 @@ + href="{{ url_prefix }}/static/AdminLTE-2.3.7/bootstrap/css/bootstrap.min.css"> + href="{{ url_prefix }}/static/AdminLTE-2.3.7/dist/css/AdminLTE.min.css"> + href="{{ url_prefix }}/static/AdminLTE-2.3.7/dist/css/skins/skin-blue.min.css"> + href="{{ url_prefix }}/static/AdminLTE-2.3.7/plugins/datatables/jquery.dataTables.css"> - - + + - - + + - - - + + + @@ -42,7 +42,7 @@ var refresh_interval = 5000; var refresh = function() { - $.get("/toplevel_data", function(data) { + $.get("{{ url_prefix }}/toplevel_data", function(data) { _.extend(toplevel_data, data); setTimeout(refresh, refresh_interval); }); @@ -155,7 +155,7 @@ - +