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

[WIP] [TT-13206] Add support for websocket rate limiting #6630

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

buger
Copy link
Member

@buger buger commented Oct 11, 2024

Should be enabled with enable_websockets_rate_limiting

This is fully native rate and quota limiting, on per INCOMING message from the user.

Does not depend on Tyk Streams.

You can set rate limits via keys/policies as usual. Will work with path based rate limiting as well.

It also returns nice compilant error and reason message in case of rate limit:

(base) % wscat -c http://127.0.0.1:8282/websocket-proxy/\?key\=eyJvcmciOiI2NTE3MGY4MWVhOWJmNjA0YmI0NzRjMDIiLCJpZCI6ImI0MDVlNmQ1NjVjNTQ3MjRhMjczMDRkMzcyNWFhODg1IiwiaCI6Im11cm11cjY0In0=
Connected (press CTRL+C to quit)
< Request served by 1781505b56ee58
> test
< test
> test
< test
> test
< test
> test
< test
> test
Disconnected (code: 4000, reason: "rate limit exceeded")

Related Issue

Motivation and Context

How This Has Been Tested

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring or add test (improvements in base code or adds test coverage to functionality)

Checklist

  • I ensured that the documentation is up to date
  • I explained why this PR updates go.mod in detail with reasoning why it's required
  • I would like a code coverage CI quality gate exception and have explained why

Should be enabled with `enable_websockets_rate_limiting`
@buger buger changed the title [WIP] Add support for websocket rate limiting [WIP] [TT-13206] Add support for websocket rate limiting Oct 11, 2024
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

Successfully merging this pull request may close these issues.

1 participant