diff --git a/jupyterhub/handlers/base.py b/jupyterhub/handlers/base.py index b0e926ec..024f4a9e 100644 --- a/jupyterhub/handlers/base.py +++ b/jupyterhub/handlers/base.py @@ -1349,7 +1349,7 @@ class UserUrlHandler(BaseHandler): self.log.warning( "Failing suspected API request to not-running server: %s", self.request.path ) - self.set_status(503) + self.set_status(404) self.set_header("Content-Type", "application/json") spawn_url = urlparse(self.request.full_url())._replace(query="") diff --git a/jupyterhub/tests/test_pages.py b/jupyterhub/tests/test_pages.py index 7140b823..133aa426 100644 --- a/jupyterhub/tests/test_pages.py +++ b/jupyterhub/tests/test_pages.py @@ -1001,7 +1001,7 @@ async def test_token_page(app): async def test_server_not_running_api_request(app): cookies = await app.login_user("bees") r = await get_page("user/bees/api/status", app, hub=False, cookies=cookies) - assert r.status_code == 503 + assert r.status_code == 404 assert r.headers["content-type"] == "application/json" message = r.json()['message'] assert ujoin(app.base_url, "hub/spawn/bees") in message