New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pybind/mgr/dashboard: add url_prefix #17119
Conversation
Changes on #16621 are necessary for these two patches to work together |
@@ -374,7 +377,7 @@ def fs_status(self, fs_id): | |||
"id": fs_id, | |||
"name": mdsmap['fs_name'], | |||
"client_count": client_count, | |||
"clients_url": "/clients/{0}/".format(fs_id), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be nice to have a simple helper function to avoid doing the +
everywhere
src/pybind/mgr/dashboard/module.py
Outdated
@@ -821,6 +831,14 @@ def get_perf_schema(self, **args): | |||
ret[k1][k2] = sorted_dict | |||
return ret | |||
|
|||
url_prefix = self.get_localized_config('url_prefix', '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this isn't something one would configure differently on different mgr daemons in the same cluster, so use a get_config rather than get_localized_config
ceph_version=global_instance().version, | ||
path_info='/osd' + cherrypy.request.path_info, | ||
toplevel_data=json.dumps(toplevel_data, indent=2), | ||
content_data=json.dumps(content_data, indent=2) | ||
) | ||
|
||
cherrypy.tree.mount(Root(), "/", conf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part confuses me: if I have a prefix of "/foo" and one is using a reverse proxy under /foo, isn't cherrypy's "/" going to appear as /foo anyway?
So by adding the prefix in the .mount
call, doesn't this end up serving at /foo/foo/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, never mind, I guess this is assuming that the reverse proxy is configured to point to "/foo" rather than pointing to "/", I think I get it now.
Please add a "Fixes: http://tracker.ceph.com/issues/20568" line to the commit message |
Ok, I've added a global helper function get_prefixed_url, changed get_localized_config to get_config, and added the "Fixes" line to the commit message. |
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 <n@nirf.de>
Signed-off-by: Nick Erdmann <n@nirf.de>
Signed-off-by: Nick Erdmann <n@nirf.de>
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 <n@nirf.de>