Skip to content

Commit

Permalink
Disable rate limiting for health endpoints (#882)
Browse files Browse the repository at this point in the history
  • Loading branch information
gunndabad authored Oct 30, 2023
1 parent eeab13a commit 6f3b56f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion TeachingRecordSystem/src/TeachingRecordSystem.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ public static void Main(string[] args)

if (env.IsProduction())
{
app.UseRateLimiter();
// Apply rate limiting to authenticated endpoints
// (i.e. everywhere except health check, status endpoints etc.)
app.UseWhen(ctx => ctx.User.Identity?.IsAuthenticated == true, x => x.UseRateLimiter());
}

app.Use((ctx, next) =>
Expand Down

0 comments on commit 6f3b56f

Please sign in to comment.