ProxyT1110

Rate limit an endpoint, not a user

When an endpoint is legitimate but a client calls it too often, rate limit it rather than block it. A WAF rule with the rate_limit action counts per rule and per client address, allows requests up to a threshold, then answers 429 for a penalty you choose. Behind a load balancer, set trusted proxies first, or the counter keys on the balancer.

Overview

A login form, a search box, an export endpoint: blocking them blocks your users. What is wrong is the rate, and the response should be proportional to that.

In Synapse a rate limit is a WAF action, not a separate system, so the same rule that identifies the traffic decides what happens to it.

When you see this

  1. One client calls an endpoint far more often than a person could.
  2. Login failures arrive at a steady, machine pace.
  3. An expensive endpoint slows down under a single client.

Steps

  1. 01

    Pick the endpoint

    Write a WAF rule that selects the traffic, and give it the rate_limit action.

    WAF rule, action rate_limit
    http.request.path == "/login" and http.request.method == "POST"
  2. 02

    Set requests, period and duration

    requests is how many are allowed in the window, period is the window in seconds, and duration is how long the client stays at 429 once over. duration is the penalty, not the window: period 60 with duration 600 counts a burst over a minute and holds the client for ten.

    Settings on the rule
    requests: 100
    period: 60
    duration: 600
  3. 03

    Behind a load balancer, set trusted proxies

    The bucket keys on the L4 socket peer. A balancer that rotates its source addresses spreads one client across many buckets, so the rule never fires; one that collapses clients onto a few addresses makes real users limit each other. List the ranges your proxies connect from, and Synapse takes the client from the first X-Forwarded-For token for those connections only.

    /etc/synapse/config.yaml
    proxy:
      trusted_proxies:
        - "10.10.0.0/20"     # your load balancer's range
    DecisionDoes traffic reach Synapse through a load balancer?

    Yes List its ranges in proxy.trusted_proxies, and only those.

    No The socket peer is the client. Nothing to do.

  4. 04

    Combine it with what you know

    A rate limit can take any condition the WAF can: tighten it for sources the threat feed already doubts.

    WAF rule, action rate_limit
    http.request.path == "/login" and threat.score > 30
  5. 05

    Count enforcement, not evaluation

    Requests under the threshold are not marked as remediated. Only those that received a 429 are, so the event stream counts enforcement.

    Every rate-limited request
    jq -c 'select(.action == "ratelimit") | {ts, src_ip, rule_id}' \
      /var/log/synapse/events.log

Common mistakes

  1. Reading duration as the window. It is the penalty.
  2. Rate limiting behind a load balancer without proxy.trusted_proxies.
  3. Widening trusted_proxies beyond your real proxies, which lets clients forge their own address.

Escalate when

  • A client that keeps coming back at the limit from new addresses: it is rotating, so match it by fingerprint instead.

Where this stops working

  • Counters are per client address: a client that rotates addresses gets a fresh bucket. Pair the limit with a fingerprint rule.
  • Rate limiting is a WAF action, so it needs proxy mode.
Run it here

Send the request. Watch where it stops.

Edit the request or any rule and the pipeline runs again. The rules are real wirefilter expressions, evaluated the way the agent evaluates them; the traffic and model scores are samples. It all runs in your browser.

Try this Set requests in window to 80: under the limit, the request passes and is not recorded as enforcement. Then set the rule's requests to 150 and send 140 again.

The request

ingress · proxy mode

Every value is a rule field. Change one and the pipeline re-runs.

Connection
Source, resolved by the platform
Fingerprints, from Dendrite
HTTP, readable in proxy mode
Model scores, sample output from Cortex
Flow behaviour, per source
Payload, what Thalamus inspects
Result Rate limited with 429
ResultRate limited with 429Proxy · WAF rate limit
  1. 01Capture and fingerprintDendrite · On the wireObserved

    Computed JA4, JA4T, JA4H for this connection. Capture only: Dendrite never blocks.

  2. 02Access rulesHillock · XDP hook, before routingPassed

    198.51.100.23 (NL, AS64501) is on no access list.

    From the threat feed: known-bad sourcesNo match
    Country, resolved to IP ranges on the platform sideNo match
  3. 03Firewall rulesHillock · TC hook, in the kernelNot used

    No firewall rules in this policy.

  4. 04Intrusion detectionThalamus · On the hostNot used

    No signatures loaded for this scenario.

  5. 05Behavioural modelsCortex · On the host CPUObserved

    Sample scores, 0 to 100: C2 2, scan 3, malicious flow 4. Nothing leaves the machine to be scored.

  6. 06Service graphHippocampus · On the hostNot used

    No workload identity on this flow.

  7. 07Smart firewall rulesAmygdala · Decided on the host, enforced in nftablesNot used

    No smart firewall rules in this policy.

  8. 08WAF rulesProxy · In the proxy, after decryptionRefused

    140 requests in 60 s, over the limit of 100: answered with 429 for the next 600 s.

    Matched
  9. 09Content scanningProxy · ClamAV, before forwardingNot reached

    No WAF rule selected this request for scanning, so nothing was scanned.

Field names and operators follow the docs: WAF and Smart Firewall. A rule that names an unknown field does not load; a field the request does not carry never matches.

What lands in the event log
{
  "ts": "2026-11-17T09:41:07.212Z",
  "layer": "waf",
  "action": "ratelimit",
  "source": "waf",
  "rule_id": "w18",
  "src_ip": "198.51.100.23",
  "src_port": 54321,
  "dst_ip": "198.51.100.10",
  "dst_port": 443,
  "src_country": "NL",
  "fingerprints": {
    "ja4t": "64240_2-4-8-1-3_1460_10",
    "ja4": "t13d1516h2_8daaf6152771_02713d6af862"
  }
}

Shaped like the documented event schema; the timestamp, ports, rule ids and ban duration are illustrative.

Now on your own traffic.

A demo runs the same pipeline against real packets, with the engineers who built it.