docs: add deployment fixes documentation (2025-09-24)
All checks were successful
build-and-push-ext / build_push (push) Successful in 4m20s
All checks were successful
build-and-push-ext / build_push (push) Successful in 4m20s
- Document Nginx rewrite fixes for /lecoffre/ 404 - Document conditional Next.js config (prod vs dev) - Document HMR setup with /lecoffre-hmr/ route - Document assets proxy /_next/ fix - Document IdNot flow validation
This commit is contained in:
parent
e6ba657e53
commit
c7034fe0d3
78
docs/DEPLOYMENT_FIXES_2025-09-24.md
Normal file
78
docs/DEPLOYMENT_FIXES_2025-09-24.md
Normal file
@ -0,0 +1,78 @@
|
||||
# Corrections de déploiement - 24 septembre 2025
|
||||
|
||||
## Problèmes résolus
|
||||
|
||||
### 1. Configuration Next.js conditionnelle
|
||||
- **Problème**: `output: 'export'` et `basePath` appliqués en dev bloquaient HMR
|
||||
- **Solution**: Configuration conditionnelle dans `next.config.js`
|
||||
```js
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
const nextConfig = {
|
||||
...(isProd ? {
|
||||
output: 'export',
|
||||
basePath: '/lecoffre',
|
||||
assetPrefix: '/lecoffre',
|
||||
trailingSlash: true,
|
||||
images: { unoptimized: true }
|
||||
} : {})
|
||||
};
|
||||
```
|
||||
|
||||
### 2. Nginx - Redirection et proxy
|
||||
- **Problème**: `/lecoffre/` retournait 404 car l'image CI ne respectait pas `basePath`
|
||||
- **Solution**: Rewrite Nginx dans `location ^~ /lecoffre/`
|
||||
```nginx
|
||||
rewrite ^/lecoffre/(.*)$ /$1 break;
|
||||
proxy_pass http://localhost:3004;
|
||||
```
|
||||
|
||||
### 3. Assets Next.js manquants
|
||||
- **Problème**: `/_next/static/` retournait 404 (assets non servis)
|
||||
- **Solution**: Route Nginx dédiée
|
||||
```nginx
|
||||
location ^~ /_next/ {
|
||||
proxy_pass http://localhost:3004/_next/;
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
}
|
||||
```
|
||||
|
||||
### 4. HMR en développement
|
||||
- **Problème**: Besoin d'HMR sans impacter la prod
|
||||
- **Solution**: Route dédiée `/lecoffre-hmr/` avec WebSocket support
|
||||
```nginx
|
||||
location ^~ /lecoffre-hmr/ {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
rewrite ^/lecoffre-hmr/(.*)$ /$1 break;
|
||||
proxy_pass http://localhost:3000;
|
||||
}
|
||||
```
|
||||
|
||||
## Architecture finale
|
||||
|
||||
### Production
|
||||
- `https://dev4.4nkweb.com/` → ihm_client (iframe)
|
||||
- `https://dev4.4nkweb.com/lecoffre/` → lecoffre-front (app principale)
|
||||
- `https://dev4.4nkweb.com/_next/` → assets Next.js
|
||||
|
||||
### Développement (HMR)
|
||||
- `https://dev4.4nkweb.com/lecoffre-hmr/` → Next.js dev server (port 3000)
|
||||
|
||||
### Flux IdNot
|
||||
- CORS dev3 configuré pour `https://dev4.4nkweb.com`
|
||||
- State management via `/api/v1/idnot/state` sur dev3
|
||||
- Callback vers `/authorized-client` (prod ou HMR)
|
||||
|
||||
## Variables d'environnement
|
||||
- `NEXT_PUBLIC_*` cohérentes entre build CI et runtime
|
||||
- `NODE_ENV=production` pour activer basePath/export
|
||||
- CORS dynamique pour dev4.4nkweb.com
|
||||
|
||||
## Tests validés
|
||||
- ✅ Redirection 301: `/lecoffre` → `/lecoffre/`
|
||||
- ✅ Page d'accueil: `/lecoffre/` → 200
|
||||
- ✅ Assets: `/_next/static/` → 200
|
||||
- ✅ HMR: `/lecoffre-hmr/` → 200
|
||||
- ✅ CORS dev3: OPTIONS 204 + POST state 200
|
||||
- ✅ ihm_client: `/` → 200
|
@ -1,14 +1,18 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
|
||||
const nextConfig = {
|
||||
reactStrictMode: false,
|
||||
output: 'export',
|
||||
basePath: '/lecoffre',
|
||||
assetPrefix: '/lecoffre',
|
||||
trailingSlash: true,
|
||||
images: {
|
||||
unoptimized: true,
|
||||
},
|
||||
...(isProd
|
||||
? {
|
||||
output: 'export',
|
||||
basePath: '/lecoffre',
|
||||
assetPrefix: '/lecoffre',
|
||||
trailingSlash: true,
|
||||
images: { unoptimized: true },
|
||||
}
|
||||
: {}),
|
||||
eslint: {
|
||||
ignoreDuringBuilds: true,
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user