요청 제한과 무차별 대입 방어
요청 제한과 무차별 대입 방어를 구현해 Node.js API를 악용, 서비스 거부, 자격 증명 대입 공격으로부터 보호하는 방법을 배워 보세요.
요청 제한과 무차별 대입 방어은(는) CoddyKit의 무료 Node.js Backend Development Bootcamp 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Node.js Backend Development Bootcamp 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Node.js Backend Development Bootcamp 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Why Limit Requests?
Without limits, a single client can hammer your API thousands of times per second — scraping data, guessing passwords, or simply overloading the server.
Rate limiting caps how many requests a client may make in a time window.
Attacks Rate Limiting Prevents
Rate limiting is a frontline defense against:
- Brute-force login attempts
- Credential stuffing with leaked passwords
- Denial-of-service floods
- Scraping and API abuse
How Counting Works
A rate limiter tracks a counter per client (usually keyed by IP). Each request increments it; when the count exceeds the limit within the window, further requests are rejected with 429 Too Many Requests.
express-rate-limit
The express-rate-limit package adds rate limiting as middleware in a few lines. Configure the window and max requests.
const rateLimit = require('express-rate-limit');
const limiter = rateLimit({
windowMs: 15 * 60 * 1000,
max: 100
});Applying the Limiter
Apply globally with app.use, or to specific routes. Once over the limit, clients automatically receive a 429 response.
app.use(limiter);
// or just protect one route:
app.use('/api/', limiter);Stricter Limits on Login
Login endpoints are prime brute-force targets, so give them a tighter limit than the rest of your API.
const loginLimiter = rateLimit({
windowMs: 10 * 60 * 1000,
max: 5,
message: 'Too many login attempts'
});
app.post('/login', loginLimiter, handler);Shared Store for Multiple Servers
The default in-memory store does not work when you run multiple instances behind a load balancer — each has its own counter. Use a shared store like Redis so limits apply across all servers.
const RedisStore = require('rate-limit-redis');
const limiter = rateLimit({
store: new RedisStore({ /* client */ }),
max: 100,
windowMs: 60000
});Trusting the Real Client IP
Behind a proxy, every request appears to come from the proxy's IP. Tell Express to trust the proxy so the limiter keys on the real client IP from X-Forwarded-For.
app.set('trust proxy', 1);Account Lockout
Beyond IP limits, track failed logins per account. After several failures, temporarily lock the account or require a CAPTCHA — defeating distributed brute-force from many IPs.
if (user.failedAttempts >= 5) {
return res.status(423).json({ error: 'Account locked' });
}Slowing Down Instead of Blocking
An alternative to hard blocks is progressive delay: each repeated request waits a little longer. The express-slow-down package adds latency rather than rejecting outright.
const slowDown = require('express-slow-down');
const speedLimiter = slowDown({
windowMs: 60000,
delayAfter: 50,
delayMs: () => 500
});Informing Clients
Good limiters send RateLimit headers telling clients their remaining quota and reset time, so well-behaved apps can back off gracefully.
const limiter = rateLimit({
max: 100,
windowMs: 60000,
standardHeaders: true
});Quick Check
Test your rate-limiting knowledge.
Recap
You learned to protect APIs from abuse:
- Rate limiting caps requests per client and returns
429when exceeded express-rate-limitadds it as middleware; use stricter limits on login- Use a Redis store across multiple servers and set
trust proxyfor real IPs - Add account lockout, progressive slow-down, and informative headers
These layers thwart brute-force, scraping, and DoS attacks.
자주 묻는 질문
“요청 제한과 무차별 대입 방어” 강의는 무료인가요?
네 — “요청 제한과 무차별 대입 방어” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Node.js Backend Development Bootcamp 강의 전체를 잠금 해제할 수 있습니다. Node.js Backend Development Bootcamp 강의에는 총 4개의 강의가 포함되어 있습니다.
“요청 제한과 무차별 대입 방어”에서 뭘 배우나요?
요청 제한과 무차별 대입 방어를 구현해 Node.js API를 악용, 서비스 거부, 자격 증명 대입 공격으로부터 보호하는 방법을 배워 보세요. 브라우저에서 직접 실행하는 실습 코드로 Node.js Backend Development Bootcamp을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Node.js Backend Development Bootcamp을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Node.js Backend Development Bootcamp은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.
“요청 제한과 무차별 대입 방어” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Node.js Backend Development Bootcamp 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Node.js Backend Development Bootcamp 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- OWASP 상위 10개 항목 이해하기
- Node.js의 안전한 코딩 관행
- 데이터 암호화 및 해싱
- 요청 제한과 무차별 대입 방어