Skip to content

MINOR: rate-limit: add rate-limit-exclude-path-end annotation to excl… - #854

Open
nocturo wants to merge 1 commit into
haproxytech:masterfrom
nocturo:rate-limit-exclude-path-end
Open

nocturo wants to merge 1 commit into
haproxytech:masterfrom
nocturo:rate-limit-exclude-path-end

Conversation

@nocturo

@nocturo nocturo commented Sep 18, 2026

Copy link
Copy Markdown

Adds a rate-limit-exclude-path-end annotation that lists path suffixes (typically static asset extensions) excluded from rate limiting. Matching requests are neither tracked nor denied.

Motivation. With a request limit in place, a single page load that pulls in many assets consumes the limit on its own, so the browser ends up rendering a partially broken page. Having the ability to exclude the assets makes the limit apply to page requests themselves, and a client over the limit can get a clean error page instead of a broken one.

Implementation.

  • ReqTrack gains an ExcludePathEnd field and emits !{ path_end ... } on the track-sc0 rule, so excluded requests never increment the counter.
  • ReqRateLimit gains the same field and appends !{ path_end ... } to the deny condition, so they are never denied either.
  • Entries are validated against ^[A-Za-z0-9._/-]+$ so annotation values cannot inject configuration into the generated conditions.
  • Available in the ConfigMap and on an Ingress. An Ingress value prefixed with + extends the ConfigMap default instead of replacing it.
  • Documentation regenerated from doc.yaml; unit tests added for parsing, cascading, and the generated conditions.

…ude paths

This annotation defines a list of path suffixes, typically static asset
extensions, that are excluded from rate limiting. Matching requests are
neither counted against the rate nor denied.

Without it, a page load that pulls in many assets consumes the limit on
its own, so the browser renders a broken page with only some assets
loaded. With the assets excluded, the limit applies to the page requests
themselves and a client over the limit gets a clean error page instead.

The value is a comma or space separated list of suffixes. Entries are
restricted to letters, digits, dots, underscores, slashes and dashes so
an annotation cannot inject arbitrary configuration into the generated
conditions. The annotation works on the configmap and on an ingress. An
ingress value starting with a plus sign extends the configmap default
instead of replacing it.
@oktalz oktalz added the enhancement New feature or request label Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants