diff --git a/jupyter_server/base/handlers.py b/jupyter_server/base/handlers.py index 248a03ac1f..f0c80173d7 100644 --- a/jupyter_server/base/handlers.py +++ b/jupyter_server/base/handlers.py @@ -573,6 +573,7 @@ def check_host(self): async def prepare(self): if not self.check_host(): + self.current_user = self._jupyter_current_user = None raise web.HTTPError(403) from jupyter_server.auth import IdentityProvider @@ -802,7 +803,8 @@ def options(self, *args, **kwargs): class Template404(JupyterHandler): """Render our 404 template""" - def prepare(self): + async def prepare(self): + await super().prepare() raise web.HTTPError(404)