Skip to content

feat(nixnuc): rate-limit ytdlfin /health endpoint in nginx#673

Merged
genebean merged 1 commit into
mainfrom
feat/ytdlfin-health-rate-limit
Jun 28, 2026
Merged

feat(nixnuc): rate-limit ytdlfin /health endpoint in nginx#673
genebean merged 1 commit into
mainfrom
feat/ytdlfin-health-rate-limit

Conversation

@genebean

@genebean genebean commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds limit_req_zone $binary_remote_addr zone=ytdlfin_health:1m rate=6r/m; to appendHttpConfig so the zone is declared in the http {} block
  • Adds location = /health to the ytdlfin virtual host with limit_req zone=ytdlfin_health burst=3 nodelay; — allows short bursts while capping sustained unauthenticated traffic at 6 requests/min per IP
  • Companion to the ytdlfin feat/health-endpoint PR which adds the actual /health endpoint

Test plan

  • nixos-rebuild applies cleanly on nixnuc
  • curl https://ytdlfin.<domain>/health returns 200 {"status":"ok"}
  • Rapid repeated curls beyond the burst limit receive 503 from nginx
  • Uptime Kuma monitor on /health stays green at its normal poll interval

🤖 Generated with Claude Code

Adds a limit_req_zone (6r/m per IP, burst 3) to appendHttpConfig and a
dedicated location = /health block in the ytdlfin virtual host so the
unauthenticated health check endpoint cannot be hammered by bots.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@genebean genebean force-pushed the feat/ytdlfin-health-rate-limit branch from e436349 to c0aba5c Compare June 28, 2026 01:41
@genebean

Copy link
Copy Markdown
Owner Author

Validated via

$ URL="https://ytdlfin.home.technicalissues.us/health"
$ for i in {1..20}; do
  code=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
  echo "Request $i: HTTP $code"
  [ "$code" = "503" ] && { echo "Got 503 — stopping."; break; }
done
Request 1: HTTP 200
Request 2: HTTP 200
Request 3: HTTP 200
Request 4: HTTP 200
Request 5: HTTP 503
Got 503 — stopping.

@genebean genebean merged commit f38b983 into main Jun 28, 2026
2 checks passed
@genebean genebean deleted the feat/ytdlfin-health-rate-limit branch June 28, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant