502 zuordnen: Proxy Manager selbst oder ein HTTP-Proxy davor

Ein 502 hat zwei moegliche Absender, und sie sehen gleich aus:

  - Der Proxy Manager selbst. Sein nginx steht, der Dienst dahinter
    nicht. Nachgemessen: nach einem Neustart antwortet die Schnittstelle
    erst nach rund zehn Sekunden mit 200 - davor kommen 000, dann 502.
  - Ein HTTP-Proxy davor, der localhost:81 von SEINEM Rechner aus zu
    erreichen versucht und scheitert.

Unterscheiden laesst sich das an der Server-Kopfzeile: der Proxy Manager
nennt sich "openresty", ein Proxy traegt sich zusaetzlich mit "Via:"
ein. Beide Faelle nachgestellt und die Kopfzeilen abgenommen.

Die Meldung wertet das jetzt aus und sagt im ersten Fall "kurz warten,
er startet noch", im zweiten "das war nicht der Proxy Manager, pruefe
noproxy". Vorher stand dort pauschal "Serverfehler" mit einem Verweis
auf noproxy - der im haeufigeren Fall in die falsche Richtung zeigte.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-21 00:03:32 +02:00
co-authored by Claude Opus 5
parent 62ccafbbd1
commit 20c773c9c4
3 changed files with 80 additions and 8 deletions
+19
View File
@@ -1220,8 +1220,27 @@ The other direction looks like this:
|---|---|---|
| `400`/`401` | the Proxy Manager refuses | account/password in `.env`, or the account does not exist → `npm-reset` |
| `000` | no answer at all | container down? port free? – the command checks both and says which applies |
| `502` | two possible senders – see below | the `Antwortete:` line reveals which |
| `5xx` + HTML | something else answered | usually the HTTP proxy; the first line of the HTML reply is shown |
**A `502` has two senders**, and they feel identical. The `Server` header,
which the message prints, tells them apart:
| `Antwortete:` | who it was | what to do |
|---|---|---|
| `openresty` (no `Via:`) | **the Proxy Manager itself** – nginx is up, the service behind it is not | usually it is still starting: after a restart it takes about **ten seconds** for the API to answer. Otherwise `logs` or `proxy restart` |
| `squid`, `Via: …` etc. | **an HTTP proxy in front** | `noproxy` – the request never reached the Proxy Manager |
The second case is treacherous, because the proxy produces the 502 while trying
to reach `localhost:81` **from its own machine**. One call tells them apart:
```bash
curl -si --noproxy '*' http://localhost:81/api/tokens -X POST \
-H 'Content-Type: application/json' -d '{}' | head -3
```
If that differs from the result without `--noproxy`, the proxy was in between.
If HTML arrives instead of JSON, it says so explicitly – including the first
line, which reveals who answered: