Return clear node-missing JSON and reset Web UI auth on 401.
Keep Ingress from rewriting API 404/405 into branded HTML; document curl/auth and a prompt for sibling sims.
This commit is contained in:
@@ -62,6 +62,9 @@ helm upgrade --install pve-sim ./helm/proxmox-api-simulator \
|
||||
6. Создаёт Ingress с
|
||||
`cert-manager.io/cluster-issuer: letsencrypt-prod` и TLS secret
|
||||
`proxmox-api-simulator-tls`.
|
||||
7. Ставит annotations Ingress, чтобы nginx не подменял JSON 404/405
|
||||
брендированными HTML-страницами (`proxy-intercept-errors: false`, узкий
|
||||
`custom-http-errors`). См. [Устранение неполадок](troubleshooting.md#ingress-отдаёт-брендированный-html-404--nginx-405-вместо-json).
|
||||
|
||||
DNS для `pve-sim.example.com` должен указывать на ваш Ingress controller. Затем:
|
||||
|
||||
|
||||
@@ -25,6 +25,45 @@ Workers могут повторять попытки, пока миграции
|
||||
- Мутация без `CSRFPreventionToken` в сессии по тикету.
|
||||
- API-токен с неверным форматом (`PVEAPIToken=user@realm!id=secret`).
|
||||
- Отказ ACL (сравните `auditor@pve` и `root@pam`).
|
||||
- В Web UI при HTTP 401 локальная сессия сбрасывается, в шапке снова **Guest**;
|
||||
войдите заново через Environment.
|
||||
|
||||
## Ingress отдаёт брендированный HTML 404 / nginx 405 вместо JSON
|
||||
|
||||
Симулятор отвечает на ошибки API JSON (`data` / `message` / `errors`). Если
|
||||
видите HTML «страница не найдена» или страницу nginx **405**, тело ответа
|
||||
подменил **Ingress / reverse proxy** (часто `custom-http-errors` у
|
||||
ingress-nginx).
|
||||
|
||||
На Ingress этого хоста (см.
|
||||
`helm/proxmox-api-simulator/values-ingress-example.yaml`):
|
||||
|
||||
```yaml
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/proxy-intercept-errors: "false"
|
||||
nginx.ingress.kubernetes.io/custom-http-errors: "502,503"
|
||||
```
|
||||
|
||||
Проверьте с `Accept: application/json`. Несуществующий узел должен выглядеть так:
|
||||
|
||||
```json
|
||||
{"data": null, "message": "No such node ('pve01')", "errors": {"node": "No such node ('pve01')"}}
|
||||
```
|
||||
|
||||
Имена узлов в seed: профиль `small` → `pve01`; `medium` / `ha-demo` → `pve1`…
|
||||
|
||||
### Корректный аутентифицированный POST (как у Proxmox)
|
||||
|
||||
Тело form-urlencoded, cookie тикета и CSRF-заголовок (не «голый» JSON POST):
|
||||
|
||||
```bash
|
||||
# после POST /api2/json/access/ticket → ticket + CSRFPreventionToken
|
||||
curl -sk -X POST "https://HOST/api2/json/nodes/pve01/ceph/osd" \
|
||||
-H "CSRFPreventionToken: $CSRF" \
|
||||
-H "Content-Type: application/x-www-form-urlencoded" \
|
||||
-b "PVEAuthCookie=$TICKET" \
|
||||
--data-urlencode "dev=/dev/sdb"
|
||||
```
|
||||
|
||||
## Задача никогда не завершается
|
||||
|
||||
|
||||
Reference in New Issue
Block a user