Add X-User-ID header to all FastAPI ML service proxy routes

- Add X-User-ID header containing user.id to all fetch calls from proxy routes
- Updated routes: /api/predict, /api/predict/batch, /api/model/info, /api/model/load, /api/patterns/detect, /api/patterns/available, /api/training/start, /api/training/runs
- Enables user scoping on the FastAPI ML service side

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marko Djordjevic 2026-02-20 13:12:25 +01:00
parent 685639a0d3
commit bd668589b6
10 changed files with 10 additions and 7 deletions

View file

@ -34,7 +34,7 @@ export async function POST(request: NextRequest) {
const response = await fetch(`${INFERENCE_API_URL}/model/load`, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-API-Key': process.env.API_KEY || '' },
headers: { 'Content-Type': 'application/json', 'X-API-Key': process.env.API_KEY || '', 'X-User-ID': user.id },
body: JSON.stringify(validatedBody),
signal: controller.signal,
});