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

Implement minimal RateLimitingMiddleware #41008

Merged
merged 34 commits into from Apr 19, 2022
Merged

Implement minimal RateLimitingMiddleware #41008

merged 34 commits into from Apr 19, 2022

Conversation

wtgodbe
Copy link
Member

@wtgodbe wtgodbe commented Apr 1, 2022

Bare bones implementation of #37384. The only scenario currently supported is the user giving us a custom configured PartitionedRateLimiter<HttpContext>, which we let do its thing. No endpoint awareness or piecemeal limiter construction is supported yet, that will be in the next pass (Right now if the user wants endpoint awareness, they must build it in to their PartitionedRateLimiter implementation). I have another branch with skeletons for that stuff (which I've deleted from this one) here: https://github.com/wtgodbe/aspnetcore/tree/wtgodbe/RateLimitMid.

Also still need to work out how we support net6 & net7 with this, which will come in the next pass.

Also todo - add a sample

_onRejected = options.Value.OnRejected;
}

// TODO - EventSource?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be valuable to add EventSource logging to this, part of the next pass?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with waiting for the next pass. It might be better to add EventSource logging to the rate limiter implemenations, but that might be too low level to be useful if there are many.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an issue tracking this yet?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wtgodbe
Copy link
Member Author

wtgodbe commented Apr 14, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@wtgodbe
Copy link
Member Author

wtgodbe commented Apr 19, 2022

@BrennanConroy @Tratcher @halter73 @davidfowl updated to reflect feedback from API review, and added a couple tests. After changing DefaultRejectionStatusCode to an int, I'm enforcing that it be a valid HTTP status code - think that's necessary?

Going to add a sample though that might not make it for preview4

@wtgodbe wtgodbe enabled auto-merge (squash) April 19, 2022 22:11
@wtgodbe wtgodbe merged commit 4e7e7da into dotnet:main Apr 19, 2022
@ghost ghost added this to the 7.0-preview4 milestone Apr 19, 2022
@wtgodbe wtgodbe deleted the wtgodbe/RateLimidMidMinimal branch April 19, 2022 23:27
@amcasey amcasey added area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlesware and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlesware
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet