Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying a custom EndpointCounterKeyBuilder per route #491

Open
Phil-G opened this issue Oct 14, 2024 · 1 comment
Open

Specifying a custom EndpointCounterKeyBuilder per route #491

Phil-G opened this issue Oct 14, 2024 · 1 comment

Comments

@Phil-G
Copy link

Phil-G commented Oct 14, 2024

I have a route that needs special handling. Something like GET /User/{userId}/Info
I want the route to have a limit, regardless of the IP or client ID. GET /User/1/Info should be tracked separately from GET /User/2/Info

It would be helpful to have more config granularity per route to prevent endpoints from getting overloaded and taxing the DB.

@kamilzzz
Copy link

kamilzzz commented Jan 3, 2025

Maybe you could apply custom attribute to endpoints, implement custom ICounterKeyBuilder where via injected IHttpContextAccessor you could read endpoint metadata, and then act accordingly?

Then you could have some special handling for annotated endpoint and use default EndpointCounterKeyBuilder for the rest of them? At least in theory as I didn't even try that :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants