feat(stats): #337 봇 UA 필터 + IP 레이트리밋
- BotDetector 유틸 (Pattern.CASE_INSENSITIVE: bot|crawler|spider|slurp|scrap|fetch|monitor|preview|lighthouse) - RateLimitService: Redis SET NX EX(60s) 패턴으로 같은 IP 윈도우 차단 - Bucket4j 대신 spring-data-redis 기존 의존성 재사용 (간결) - Redis 다운 시 fail-open (사용자 경험 우선) - StatsController.recordVisit: HttpServletRequest 받아 UA + X-Forwarded-For 우선 IP - 봇/리밋 초과 → 200 + counted:false (사용자 페이지 로드 지장 X) - 통과 → 200 + counted:true → statsService.recordVisit() - application.yml: app.rate-limit.visit-window-seconds (env VISIT_WINDOW_SECONDS) 기본 60 - dev 검증: 봇 UA → counted=false, Mozilla → true, 즉시 재호출 → false 설계서: docs/design/337-stats-bot-ratelimit/README.md Refs: #337 (Developer 단계)
This commit is contained in:
@@ -64,6 +64,10 @@ app:
|
||||
# 0.57은 cohere embed-v4 한국어 시맨틱 적합도 기준 경험값.
|
||||
max-distance: ${SEARCH_MAX_DISTANCE:0.57}
|
||||
|
||||
rate-limit:
|
||||
# #337 — 같은 IP에서 visit 카운트 허용 간격(초). 기본 60.
|
||||
visit-window-seconds: ${VISIT_WINDOW_SECONDS:60}
|
||||
|
||||
build:
|
||||
# #338 — 배포 시 deploy.sh가 env로 주입. dev에서는 dev/unknown.
|
||||
version: ${APP_VERSION:dev}
|
||||
|
||||
Reference in New Issue
Block a user