diff --git a/tools/proxy/server.js b/tools/proxy/server.js index b759559..bc0a3dd 100644 --- a/tools/proxy/server.js +++ b/tools/proxy/server.js @@ -63,12 +63,12 @@ function authMiddleware(req, res, next) { next(); } -// Global middleware: Auth first (skip /health), then body parser +// Global middleware: Body parser first, then auth (skip /health) +app.use(bodyParser.json({ limit: '10mb' })); app.use((req, res, next) => { if (req.path === '/health') return next(); authMiddleware(req, res, next); }); -app.use(bodyParser.json({ limit: '10mb' })); // Gemini Client with JSON response configuration const genAI = new GoogleGenerativeAI(API_KEY); @@ -224,7 +224,7 @@ app.get('/health', (req, res) => { }); // Start Server -app.listen(PORT, () => { +app.listen(PORT, '0.0.0.0', () => { console.log(`Proxy Server running on port ${PORT}`); if (!API_KEY) console.error('WARNING: GEMINI_API_KEY is not set!'); if (!AUTH_TOKEN) console.error('WARNING: PROXY_AUTH_TOKEN is not set! Authentication is disabled.');