Summary
Add GATEKEEPER_RATE_LIMIT_BYPASS_IPS (comma-separated) and GATEKEEPER_RATE_LIMIT_BYPASS_KEY (checked via x-ratelimit-bypass header) env vars to exempt specific requests from rate limiting Replace tower_governor with custom middleware using the governor crate directly, since tower_governor has no built-in bypass mechanism All 4 rate-limited routes (sign-in, createSession, createAccount, gate/signup) use the new middleware Motivation
Certain trusted IPs (e.g. the PDS itself at 148.251.49.115) were being rate-limited, producing "Rate limit exceeded for smart IP" log noise. The PDS already supports PDS_RATE_LIMIT_BYPASS_KEY and PDS_RATE_LIMIT_BYPASS_IPS โ this brings the same pattern to gatekeeper.
Test plan
11 new unit tests in src/rate_limit.rs covering IP extraction, bypass by IP, bypass by token, unconfigured default, env parsing, 429 enforcement, and bypass passthrough All 37 tests pass (cargo test) Manual smoke test: hit a rate-limited endpoint with/without bypass header/IP
Note: vibe coded with Claude Code
I'm going to chew a bit more on this one since it could have some bigger changes if that works for you. I think the original reason for this PR may be covered now for eurosky (the eu-hauler need for it)?
I want to see a bit more what the PDS does on some of these endpoints and see if I also need to add rate limiting per did as well for server side applications and try and decide the best path on it