do not print a proxy's error page at somebody
first real test of the settings form returned openresty's 502 Bad Gateway document, markup and all, into the panel. installing this plugin restarts officer, and a request made inside that window reaches nginx proxy manager, finds nothing behind it, and gets a web page back. useClient throws the response body as the message, so the panel printed it. worth keeping the irony: this plugin manages the proxy whose error page it could not read. the check is the body's SHAPE, not the status, because there is no status that separates them — api/router.ts uses 502 for "NPM answered and refused", which is a real answer we must not swallow. ours arrives as a sentence, theirs as a document. gateway status AND html means the hop in front of officer answered; html on its own still is not a sentence and says so without the tags. all three panels go through it now. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Officer-Session: 656f5c85-e49a-4f1f-b9f3-042a04b4d043
This commit is contained in:
+2
-1
@@ -3,6 +3,7 @@ import { AlertTriangle, Globe, Lock, LockOpen, Power, RefreshCw, Settings, Shiel
|
||||
import { useClient } from "hooks/useClient";
|
||||
import { useSearchParams } from "react-router";
|
||||
import { ConnectionPanel } from "./ConnectionPanel";
|
||||
import { readableError } from "./errors";
|
||||
|
||||
/**
|
||||
* The proxy hosts, which is the thing anybody opens this plugin to see.
|
||||
@@ -42,7 +43,7 @@ type Failure = { error: string; likelyAuth?: boolean; unreachable?: boolean; unc
|
||||
*/
|
||||
const asFailure = (error: unknown): Failure => {
|
||||
const status = (error as { status?: number })?.status;
|
||||
const message = error instanceof Error ? error.message : "Could not load hosts.";
|
||||
const message = readableError(error, "Could not load hosts.");
|
||||
return {
|
||||
error: message,
|
||||
unconfigured: status === 409,
|
||||
|
||||
Reference in New Issue
Block a user