diff --git a/server.js b/server.js index 98a67107..14697ff6 100644 --- a/server.js +++ b/server.js @@ -116,6 +116,8 @@ async function createSessionJWT(userId) { } const app = express(); +// nginx リバースプロキシ背後のため X-Forwarded-For を信頼して req.ip を正しく解決 +app.set('trust proxy', 1); // Stripe Webhook は raw body が必要なため、webhook パスのみ json パースをスキップ app.use((req, res, next) => { if (req.path === '/brain/api/stripe/webhook' || req.path === '/api/stripe/webhook') {