no_proxy vergleicht Namen, keine Adressen - NPM_API_HOST

Der Kern des Problems, und die Stelle, an der man am laengsten sucht:
"no_proxy=localhost" deckt eine Anfrage an 127.0.0.1 NICHT ab, und
umgekehrt genauso wenig. An curl 7.88 nachgemessen:

  no_proxy      an 127.0.0.1      an localhost
  localhost     ueber den Proxy   direkt
  127.0.0.1     direkt            ueber den Proxy

In Firmennetzen steht oft nur "localhost" in der Ausnahmeliste - dann
laeuft ausgerechnet der Zugriff auf die Schnittstelle des Proxy
Managers ueber den Proxy, obwohl no_proxy dem Anschein nach gesetzt
ist.

Deshalb NPM_API_HOST: damit laesst sich die Schnittstelle als
"localhost" ansprechen, ohne die Ausnahmeliste zu aendern - was im
Kundennetz oft nicht in der eigenen Hand liegt. Vorgabe bleibt
127.0.0.1, denn das kommt ohne Namensaufloesung aus und zeigt immer auf
IPv4.

"noproxy" prueft jetzt beide Schreibweisen einzeln und sagt, welche
fehlt, statt nur "geht nicht" zu melden:

  http://127.0.0.1:81/         geht an den Proxy
  http://localhost:81/         direkt
  [ WARN ] Nur 'localhost' ist ausgenommen, 127.0.0.1 nicht.
           Bis das geaendert ist, hilft sofort:
             cmk-manage.sh config set NPM_API_HOST localhost

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-20 23:44:07 +02:00
co-authored by Claude Opus 5
parent 20eceda183
commit eb29db0130
4 changed files with 112 additions and 7 deletions
+31
View File
@@ -556,6 +556,7 @@ The most important settings:
| `TZ` | time zone, e.g. `Europe/Berlin` |
| `NPM_ENABLED` | `on`/`off` – should the Proxy Manager container run at all? See [12.4](#124-turning-the-proxy-manager-off-entirely-external-nginx) |
| `NPM_ADMIN_PORT` | port of the Proxy Manager interface (default 81) – change only via `npm-port` or the menu |
| `NPM_API_HOST` | name the API is addressed by (`127.0.0.1` or `localhost`) – see [chapter 14.6](#146-networks-with-a-mandatory-proxy-an-api-error-that-is-none) |
| `NPM_ADMIN_URL` | start page of the terminal browser; empty = derived from `NPM_ADMIN_PORT` |
| `BACKUP_DIR` | location for **manual** backups (default `./backups`); scheduled jobs have their own paths |
| `BACKUP_AUTO` | `on`/`off` – should the backup jobs run via cron? |
@@ -2649,6 +2650,36 @@ This is not guessed but read from what `curl -v` reports itself
(`Uses proxy env variable http_proxy == …`) – nothing needs to be listening on
the target address for that.
### `no_proxy` matches names, not addresses
This is where the search takes longest: `no_proxy=localhost` does **not** cover
a request to `127.0.0.1` – and vice versa. Measured with curl 7.88:
| `no_proxy` | request to `127.0.0.1` | request to `localhost` |
|---|---|---|
| `localhost` | **goes to the proxy** | direct |
| `127.0.0.1` | direct | **goes to the proxy** |
| both | direct | direct |
Corporate networks often list only `localhost`. Then of all things the access
to the Proxy Manager's API goes through the proxy. `noproxy` therefore checks
**both** spellings and says which one is missing:
```
Gehen lokale Anfragen daran vorbei?
http://127.0.0.1:81/ geht an den Proxy
http://localhost:81/ direkt
[ WARN ] Nur 'localhost' ist ausgenommen, 127.0.0.1 nicht.
Bis das geaendert ist, hilft sofort:
cmk-manage.sh config set NPM_API_HOST localhost
```
`NPM_API_HOST` decides which name the API is addressed by – default
`127.0.0.1`, because that needs no name resolution and always points at IPv4.
If the exception list in the customer network cannot be changed, switching to
`localhost` is the shorter path.
**In the running session** – a program cannot change its parent shell's
environment, hence the detour via `eval`: