RFE-2924: Return HTTP 429 when route HTTP rate limit is exceeded - #823
RFE-2924: Return HTTP 429 when route HTTP rate limit is exceeded#823sanjaytripathi97 wants to merge 1 commit into
Conversation
When haproxy.router.openshift.io/rate-limit-connections.rate-http is hit, use http-request deny deny_status 429 instead of silently rejecting the TCP connection so clients get a proper HTTP status. TCP concurrent and connection-rate limits remain tcp-request reject.
|
@sanjaytripathi97: This pull request references RFE-2924 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the feature request to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
WalkthroughThe HAProxy route template now responds with HTTP 429 when configured HTTP request-rate limits are exceeded. Tests cover this behavior for edge TLS and insecure backends. ChangesHTTP rate limiting
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @sanjaytripathi97. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Summary
haproxy.router.openshift.io/rate-limit-connections.rate-httpis exceeded, HAProxy previously usedtcp-request content reject, which dropped the connection with no HTTP status (clients saw "Empty reply from server").http-request deny deny_status 429so rate-limited HTTP clients receive HTTP 429 Too Many Requests.concurrent-tcpandrate-tcpastcp-request content reject(TCP-layer limits; no HTTP response is possible). Passthrough backends are unchanged (norate-httpthere).Fixes: https://issues.redhat.com/browse/RFE-2924
Changes
images/router/haproxy/conf/haproxy-config.template: usehttp-request deny deny_status 429forrate-http.pkg/router/router_test.go: addTestConfigTemplatecases for edge and insecure backends.Test plan
CGO_ENABLED=1 go test -mod=vendor -count=1 -timeout 120s -v ./pkg/router/ -run 'TestConfigTemplate'rate-http, exceed the limit, confirm response is429(not empty reply)concurrent-tcp/rate-tcpstill reject without an HTTP statusSummary by CodeRabbit
Bug Fixes
Tests