    def _validate_hub_routespec(self, proposal):
        """ensure leading/trailing / on custom routespec prefix

        - trailing '/' always required
        - leading '/' required unless using subdomains
        """
        routespec = proposal.value
        if not routespec.endswith("/"):
            routespec = routespec + "/"
        if not self.subdomain_host and not routespec.startswith("/"):
            routespec = "/" + routespec
        return routespec
ensure leading/trailing / on custom routespec prefix

- trailing '/' always required
- leading '/' required unless using subdomains
jupyterhub/app.py