diff --git a/README.md b/README.md index d67cf10..600ee17 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ dig @127.0.0.1 google.com # ✓ resolves normally dig @127.0.0.1 ads.google.com # ✗ blocked → 0.0.0.0 ``` -Open the dashboard: **http://localhost:5380** +Open the dashboard: **http://numa.numa** (or `http://localhost:5380`) Or build from source: ```bash diff --git a/src/proxy.rs b/src/proxy.rs index 787bbf9..761a0d1 100644 --- a/src/proxy.rs +++ b/src/proxy.rs @@ -141,9 +141,120 @@ async fn proxy_handler(State(state): State, req: Request) -> axum::r Some(entry) => entry.target_port, None => { return ( - StatusCode::BAD_GATEWAY, + StatusCode::NOT_FOUND, + [(hyper::header::CONTENT_TYPE, "text/html; charset=utf-8")], format!( - "unknown service: {}{}", + r##" + +404 — {0}{1} + + + + +
+
404
+
{0}{1}
+

This service isn't registered yet.
Add it from the dashboard or:

+
$ curl -X POST numa.numa:5380/services \
+    -H 'Content-Type: application/json' \
+    -d '{{"name":"{0}","target_port":3000}}'
+
ma-ia hii, ma-ia huu, ma-ia haa, ma-ia ha-ha
+
+"##, service_name, state.ctx.proxy_tld_suffix ), )