diff --git a/.env b/.env index 235bb06..30228a5 100644 --- a/.env +++ b/.env @@ -36,6 +36,10 @@ LOG_ALL_DETECTIONS=true API_DEBUG=true STORE_RAW_PAYLOAD=true +# Rate Limiting Configuration +RATE_LIMIT_WINDOW_MS=900000 +RATE_LIMIT_MAX_REQUESTS=1000 + # Health Probe Simulator Configuration PROBE_FAILRATE=30 PROBE_INTERVAL_SECONDS=60 diff --git a/docker-compose.yml b/docker-compose.yml index 07f9658..c3f9dc6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -69,6 +69,8 @@ services: STORE_DRONE_TYPE0: ${STORE_DRONE_TYPE0:-false} LOG_ALL_DETECTIONS: ${LOG_ALL_DETECTIONS:-false} STORE_RAW_PAYLOAD: ${STORE_RAW_PAYLOAD:-false} + RATE_LIMIT_WINDOW_MS: ${RATE_LIMIT_WINDOW_MS:-900000} + RATE_LIMIT_MAX_REQUESTS: ${RATE_LIMIT_MAX_REQUESTS:-1000} ports: - "3002:3001" volumes: diff --git a/server/index.js b/server/index.js index 6ecf4c5..1c4ed6f 100644 --- a/server/index.js +++ b/server/index.js @@ -34,7 +34,7 @@ const io = new Server(server, { // Rate limiting (exclude detections endpoint for testing) const limiter = rateLimit({ windowMs: parseInt(process.env.RATE_LIMIT_WINDOW_MS) || 15 * 60 * 1000, // 15 minutes - max: parseInt(process.env.RATE_LIMIT_MAX_REQUESTS) || 100, + max: parseInt(process.env.RATE_LIMIT_MAX_REQUESTS) || 1000, // Increased from 100 to 1000 message: 'Too many requests from this IP, please try again later.', skip: (req) => { // Skip rate limiting for drone detection endpoints during testing