Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Ignore rate limits for local/loopback IP traffic (#2331)
## Why is this change needed? When using a proxy in front of the hub you'll get rate limit errors even though the traffic is coming from different IPs. Until we support the `X-Forwarded-For`, this is a quick way to unblock the use of reverse proxies like nginx or Caddy. ## Merge Checklist - [x] PR title adheres to the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard - [x] PR has a [changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets) - [x] PR has been tagged with a change label(s) (i.e. documentation, feature, bugfix, or chore) - [x] PR includes [documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs) if necessary. <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on enhancing the rate limiting functionality to ignore rate limits for local loopback traffic, specifically allowing requests from `127.0.0.1` without restrictions. ### Detailed summary - Updated `rateLimits.ts` to bypass rate limits for local loopback IP `127.0.0.1`. - Removed rate limit check in `server.ts` for local requests. - Added a test in `rateLimits.test.ts` to ensure local requests are not rate limited. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
- Loading branch information