feat(nixnuc): rate-limit ytdlfin /health endpoint in nginx#673
Merged
Conversation
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>
e436349 to
c0aba5c
Compare
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
limit_req_zone $binary_remote_addr zone=ytdlfin_health:1m rate=6r/m;toappendHttpConfigso the zone is declared in thehttp {}blocklocation = /healthto the ytdlfin virtual host withlimit_req zone=ytdlfin_health burst=3 nodelay;— allows short bursts while capping sustained unauthenticated traffic at 6 requests/min per IPfeat/health-endpointPR which adds the actual/healthendpointTest plan
nixos-rebuildapplies cleanly on nixnuccurl https://ytdlfin.<domain>/healthreturns200 {"status":"ok"}503from nginx/healthstays green at its normal poll interval🤖 Generated with Claude Code