From 5d4326f46fc52425aeae4f59b95cdff58689e823 Mon Sep 17 00:00:00 2001 From: mbecker20 Date: Fri, 3 Oct 2025 03:17:37 -0700 Subject: [PATCH] NOT_FOUND if server not found --- bin/core/src/connection/server.rs | 2 +- bin/periphery/src/connection/client.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/core/src/connection/server.rs b/bin/core/src/connection/server.rs index 927a40408..7bad28fc1 100644 --- a/bin/core/src/connection/server.rs +++ b/bin/core/src/connection/server.rs @@ -29,7 +29,7 @@ pub async fn handler( let server = crate::resource::get::(&_server) .await - .status_code(StatusCode::BAD_REQUEST)?; + .status_code(StatusCode::NOT_FOUND)?; if !server.config.enabled { return Err(anyhow!("Server is Disabled.")) diff --git a/bin/periphery/src/connection/client.rs b/bin/periphery/src/connection/client.rs index b69efa6bb..98c18875d 100644 --- a/bin/periphery/src/connection/client.rs +++ b/bin/periphery/src/connection/client.rs @@ -94,8 +94,9 @@ async fn connect_websocket( .await .map_err(|e| match e { tungstenite::Error::Http(response) => match response.status() { - StatusCode::BAD_REQUEST => anyhow!("400 Bad Request: Server '{connect_as}' does not exist, is disabled, or is configured to make Core → Periphery connection"), - StatusCode::UNAUTHORIZED => anyhow!("401 Unauthorized: Only one Server connected as '{connect_as}' is allowed."), + StatusCode::NOT_FOUND => anyhow!("404 Not Found: Server '{connect_as}' does not exist."), + StatusCode::BAD_REQUEST => anyhow!("400 Bad Request: Server '{connect_as}' is disabled or configured to make Core → Periphery connection"), + StatusCode::UNAUTHORIZED => anyhow!("401 Unauthorized: Only one Server connected as '{connect_as}' is allowed. Or the Core reverse proxy needs to forward host and websocket headers."), _ => anyhow::Error::from(tungstenite::Error::Http(response)), }, e => anyhow::Error::from(e),