fix: trust proxy を設定して req.ip を正しくクライアントIPに解決
nginx リバースプロキシ背後では req.ip がプロキシの内部 IP になる問題を修正。
app.set('trust proxy', 1) で X-Forwarded-For を信頼し、IP ベースの
レート制限(together/ponshu)が実際のクライアント IP で動作するようにする。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
548c4fcca2
commit
ec51c2ed6b
|
|
@ -116,6 +116,8 @@ async function createSessionJWT(userId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
// nginx リバースプロキシ背後のため X-Forwarded-For を信頼して req.ip を正しく解決
|
||||||
|
app.set('trust proxy', 1);
|
||||||
// Stripe Webhook は raw body が必要なため、webhook パスのみ json パースをスキップ
|
// Stripe Webhook は raw body が必要なため、webhook パスのみ json パースをスキップ
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
if (req.path === '/brain/api/stripe/webhook' || req.path === '/api/stripe/webhook') {
|
if (req.path === '/brain/api/stripe/webhook' || req.path === '/api/stripe/webhook') {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue