[PR #2511] [MERGED] fix: return local IP in development mode #4348

Closed
opened 2026-03-13 11:42:34 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/2511
Author: @DiiiaZoTe
Created: 5/2/2025
Status: Merged
Merged: 9/11/2025
Merged by: @himself65

Base: canaryHead: fix/getIp


📝 Commits (1)

  • 3a11445 fix: return local IP in development mode for getIp function

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/utils/get-request-ip.ts (+4 -1)

📄 Description

In the getIp function, added a condition to return the loopback IP address (127.0.0.1) when running in development mode. This ensures that Better Auth's rate limiting functions correctly during local development by providing a consistent IP address. This change addresses issues where the client's IP address isn't available in local development environments because it is set to ::1 or another value, leading to the rate limiter not functioning as intended as it will not pass the isValidIp check.


🔄 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/2511 **Author:** [@DiiiaZoTe](https://github.com/DiiiaZoTe) **Created:** 5/2/2025 **Status:** ✅ Merged **Merged:** 9/11/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/getIp` --- ### 📝 Commits (1) - [`3a11445`](https://github.com/better-auth/better-auth/commit/3a11445432b3251a1a78731525e328a7ee9f5c0c) fix: return local IP in development mode for getIp function ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/utils/get-request-ip.ts` (+4 -1) </details> ### 📄 Description In the getIp function, added a condition to return the loopback IP address (127.0.0.1) when running in development mode. This ensures that Better Auth's rate limiting functions correctly during local development by providing a consistent IP address. This change addresses issues where the client's IP address isn't available in local development environments because it is set to ::1 or another value, leading to the rate limiter not functioning as intended as it will not pass the isValidIp check. --- <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-03-13 11:42:34 -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#4348