[PR #3365] [MERGED] Extend Rate Limiting Docs and add small warning #30386

Closed
opened 2026-04-17 21:29:57 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3365
Author: @work-in-progress-danny
Created: 7/14/2025
Status: Merged
Merged: 7/14/2025
Merged by: @Bekacru

Base: mainHead: main


📝 Commits (4)

  • 4b12505 refactor: remove useless variable assignment
  • b47ebce refactor: remove unused param
  • 301b801 docs: extend rate limit docs to include info about connecting ip address and how it's used
  • bd60606 fix: linting

📊 Changes

4 files changed (+28 additions, -5 deletions)

View changed files

📝 docs/content/docs/concepts/rate-limit.mdx (+22 -0)
📝 packages/better-auth/src/api/rate-limiter/index.ts (+3 -2)
📝 packages/better-auth/src/types/options.ts (+1 -1)
📝 packages/better-auth/src/utils/get-request-ip.ts (+2 -2)

📄 Description

I fell for something like what this issue is mentioning but my issue was it wasn't clear how rate limiting was working as the docs didn't mention it uses the connecting IP and wasn't throwing any issues and failing silently.

This change is to explicitly mention the use of IP in the rate limiting docs and if it's trying to be used but doesn't find an IP address to console.warn.

I'm using better-auth with cloudflare workers, then the cf-connecting-ip is what cloudflare provides with the request.

Also a small clean up of createDBStorage as the param was not being used inside the function body and removing the unnecessary variable assignment testIP


Summary by cubic

Updated the rate limiting documentation to explain how connecting IP addresses are used, and added a warning if no IP is found during rate limiting.

  • Docs and Warnings
    • Clarified in the docs that rate limiting uses the connecting IP and how to configure custom headers.
    • Added a console warning when no IP address is found for rate limiting.
    • Cleaned up unused variables and parameters in related code.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/3365 **Author:** [@work-in-progress-danny](https://github.com/work-in-progress-danny) **Created:** 7/14/2025 **Status:** ✅ Merged **Merged:** 7/14/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (4) - [`4b12505`](https://github.com/better-auth/better-auth/commit/4b12505f753eeab5da331fbf6e76490bb46777c2) refactor: remove useless variable assignment - [`b47ebce`](https://github.com/better-auth/better-auth/commit/b47ebce985378cae6907022f9ede1454adb6e72c) refactor: remove unused param - [`301b801`](https://github.com/better-auth/better-auth/commit/301b8016652407f632de4cddb7476e81034805f5) docs: extend rate limit docs to include info about connecting ip address and how it's used - [`bd60606`](https://github.com/better-auth/better-auth/commit/bd60606c4a2dd9f8dda5864ba8c862159a55bbdb) fix: linting ### 📊 Changes **4 files changed** (+28 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/concepts/rate-limit.mdx` (+22 -0) 📝 `packages/better-auth/src/api/rate-limiter/index.ts` (+3 -2) 📝 `packages/better-auth/src/types/options.ts` (+1 -1) 📝 `packages/better-auth/src/utils/get-request-ip.ts` (+2 -2) </details> ### 📄 Description I fell for something like what[ this issue](https://github.com/better-auth/better-auth/issues/3264) is mentioning but my issue was it wasn't clear how rate limiting was working as the docs didn't mention it uses the connecting IP and wasn't throwing any issues and failing silently. This change is to explicitly mention the use of IP in the rate limiting docs and if it's trying to be used but doesn't find an IP address to `console.warn`. I'm using better-auth with cloudflare workers, then the `cf-connecting-ip` is what cloudflare provides with the request. Also a small clean up of `createDBStorage` as the param was not being used inside the function body and removing the unnecessary variable assignment `testIP` <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Updated the rate limiting documentation to explain how connecting IP addresses are used, and added a warning if no IP is found during rate limiting. - **Docs and Warnings** - Clarified in the docs that rate limiting uses the connecting IP and how to configure custom headers. - Added a console warning when no IP address is found for rate limiting. - Cleaned up unused variables and parameters in related code. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 21:29:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#30386