4NK_env/tests/lecoffre_node/api_routing.md
LeCoffre Deployment d94a8c430e auto_clea
2025-09-25 15:03:44 +00:00

72 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### Tests de routage API et front (dev4)
Pré-requis: Nginx rechargé et services Docker démarrés.
1) Santé backend via Nginx (HTTP)
Commande:
curl -sS -D - http://127.0.0.1/back/v1/health -o /dev/null | sed -n '1,10p'
Attendu: `HTTP/1.1 200` (ou `302` selon auth), jamais du HTML de front.
2) Santé backend via Nginx (HTTPS)
Commande:
curl -sS -D - https://dev4.4nkweb.com/back/v1/health -o /dev/null | sed -n '1,10p'
Attendu: `HTTP/2 200`.
3) Front `/lecoffre` (HTTPS)
Commande:
curl -sS -D - https://dev4.4nkweb.com/lecoffre/ -o /dev/null | sed -n '1,10p'
Attendu: `HTTP/2 200` et pas de 301/302 en boucle.
### Plan de tests — routage API via Nginx
#### Pré-requis
- Nginx actif avec `conf/nginx/dev4.4nkweb.com.conf` chargé.
- Services: backend (8080), storage (8081), ws relay (8090), blindbit (8000), front (3000/3003).
#### Vérifications HTTP
- GET `https://dev4.4nkweb.com/back/health` → 200
- (Si alias validé) GET `https://dev4.4nkweb.com/api/health` → 200
- GET `https://dev4.4nkweb.com/storage/health` → 200
#### Vérifications front
- Ouvrir `https://dev4.4nkweb.com/lecoffre/` → 200, pas derreurs CORS ni `ERR_BLOCKED_BY_CLIENT`.
- Ouvrir la console réseau: les appels API doivent cibler `/back/...` (ou `/api/...`) sous le même hôte.
#### Non-régression: absence de `localhost:8080` dans les bundles
- Télécharger la page et scanner les scripts:
- `curl -sS https://dev4.4nkweb.com/lecoffre/ -o /tmp/lecoffre_index.html`
- `grep -oP '(?<=<script src=")[^"]+' /tmp/lecoffre_index.html | sed 's#^/#https://dev4.4nkweb.com/#' | while read u; do curl -sS "$u" | grep -q 'localhost:8080' && echo "KO: $u"; done`
- Attendu: aucun `KO:`
#### Vérification réécriture `sub_filter`
- Contrôler quaucune requête ne vise `http://localhost:8080`:
- Recharger avec cache vidé et surveiller longlet Réseau.
- Télécharger une ressource HTML/JS et vérifier labsence de `http://localhost:8080`.
#### Redirections locales
- `curl -I http://dev3.4nkweb.com/` → 301 Location `https://dev4.4nkweb.com/lecoffre/`
- `curl -I http://dev3.4nkweb.com/authorized-client?code=ABC` → 301 Location `https://dev4.4nkweb.com/lecoffre/authorized-client?code=ABC`
#### WebSocket
- `wss://dev4.4nkweb.com/ws` handshake OK (101)
#### Journaux Nginx
- `error.log`: aucun message critique après rechargement.