diff --git a/jupyterhub/services/service.py b/jupyterhub/services/service.py index 546c8c78..894d45af 100644 --- a/jupyterhub/services/service.py +++ b/jupyterhub/services/service.py @@ -204,7 +204,7 @@ class Service(LoggingConfigurable): @property def prefix(self): - return url_path_join(self.base_url, 'services', self.name) + return url_path_join(self.base_url, 'services', self.name + '/') @property def proxy_path(self): diff --git a/jupyterhub/singleuser.py b/jupyterhub/singleuser.py index 6366f700..65c69164 100755 --- a/jupyterhub/singleuser.py +++ b/jupyterhub/singleuser.py @@ -180,6 +180,17 @@ class SingleUserNotebookApp(NotebookApp): def _base_url_default(self): return os.environ.get('JUPYTERHUB_SERVICE_PREFIX') or '/' + #Note: this may be removed if notebook module is >= 5.0.0b1 + @validate('base_url') + def _validate_base_url(self, proposal): + """ensure base_url starts and ends with /""" + value = proposal.value + if not value.startswith('/'): + value = '/' + value + if not value.endswith('/'): + value = value + '/' + return value + @default('cookie_name') def _cookie_name_default(self): if os.environ.get('JUPYTERHUB_SERVICE_NAME'): diff --git a/requirements.txt b/requirements.txt index 82528a48..7271e737 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ alembic -traitlets>=4.3 +traitlets>=4.3.2 tornado>=4.1 jinja2 pamela