v1.54.0
🚀 Features
🔹 Server-Side Rate Limiter Middleware
GoFr now includes a built-in Rate Limiter Middleware to protect your APIs from abuse and ensure fair resource distribution.
- Token Bucket Algorithm: Implements smooth rate limiting with configurable burst capacity.
- Per-IP Rate Limiting: Support for independent limits per client IP with trusted proxy support (
X-Forwarded-For,X-Real-IP). - Observability: Automatically tracks rate limit violations with the
app_http_rate_limit_exceeded_totalmetric. - Exemptions: Built-in health check endpoints (
/.well-known/alive,/.well-known/health) are automatically exempt.
Usage Example
app.UseMiddleware(middleware.RateLimiter(middleware.RateLimiterConfig{
RequestsPerSecond: 10,
Burst: 20,
PerIP: true,
}, app.Metrics()))🛠️ Fixes
🔹 Circuit Breaker & Health Check Refinement
Improved the reliability of the Circuit Breaker and Health Check mechanisms:
- Custom Health Endpoints: Fixed an issue where custom health endpoints were not consistently used by the circuit breaker for recovery checks.