contrib: add per-websocket-connection frame rate limit filter - #46899
contrib: add per-websocket-connection frame rate limit filter#46899Amila-Rukshan wants to merge 1 commit into
Conversation
Signed-off-by: Amila Senadheera <amilaruk1995@gmail.com>
d2b2bf5 to
f6b4742
Compare
|
what's the motivation here? can't you just maintain it as a dynamic module with Rust SDK, no? |
|
@mathetake, wouldn’t the dynamic module still require the Envoy user to implement the WebSocket codec themselves? This filter is being added as a contrib extension for the general use case, as suggested #28724 (comment). The WebSocket codec was originally added to support frame-level limiting, as discussed #13877 (comment). The related link in the issue description will connect all discussions that have happened previously. |
|
I am sorry but it seems like you are the only person who is likely to use/maintain. One criteria we have for contrib is that it at least needs to be useful fo/interesting to other end users. Given the lack of interests (the original issue is a few years ago and no one commented on it) and lack of end users requesting for this exact feature, i would recommend you maintain the code by yourself rather than putting a burden on maintainer |
|
I understand your call on this as a maintainer. Thanks for the clarification! |
Related: #28724
Adds
envoy.filters.http.ws_local_ratelimit, a contrib HTTP filter that rate limits WebSocket data frames (text/binary/continuation) per WebSocket session using a local (non-shared) token bucket, with no descriptor matching.Changes
StreamInfo::FilterStateatLifeSpan::Request. This matters specifically for HTTP/2 and HTTP/3 downstream connections: multiple independent WebSocket sessions can be multiplexed as separate streams over one physical connection (RFC 8441 / RFC 9220 extended CONNECT), and each must get its own bucket rather than sharing one across the whole connection.rejection_message: sent back to the client as a WebSocket text frame when a frame is rejected; if unset, the frame is silently dropped.Common::UnifiedFactoryBase), matching every other contrib HTTP filter.Testing
contrib/ws_local_ratelimit/filters/http/test:ws_local_ratelimit_filter_test,:config_test.:ws_local_ratelimit_integration_test— HTTP/1.1, HTTP/2, and HTTP/3 downstream, including multi-stream multiplexing over one connection for H2/H3.envoy-staticbinary with Go clients (golang.org/x/net/http2,quic-go/http3) confirming single-connection multiplexing and correct per-session rate limiting over the real wire protocol.ws rate limit config example
envoy config