Skip to content
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

Merged
merged 3 commits into from Aug 29, 2017
Merged

pybind/mgr/dashboard: add url_prefix #17119

merged 3 commits into from Aug 29, 2017

Conversation

nrdmn
Copy link
Contributor

@nrdmn nrdmn commented Aug 21, 2017

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>

@nrdmn
Copy link
Contributor Author

nrdmn commented Aug 21, 2017

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),
Copy link
Contributor

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

@@ -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', '')
Copy link
Contributor

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)
Copy link
Contributor

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/?

Copy link
Contributor

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.

@jcsp
Copy link
Contributor

jcsp commented Aug 22, 2017

Please add a "Fixes: http://tracker.ceph.com/issues/20568" line to the commit message

@nrdmn
Copy link
Contributor Author

nrdmn commented Aug 22, 2017

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants