The Rate Limit Response phase adds rate limit zones to the current request based on the response characteristics. The system checks the request against the specified zone in the subsequent Rate Limit Request phase.
rate_limit.add_zone
: Adds a request to a rate limit zone based on response characteristics. This action does not perform any rate limiting checks.The filter matches responses with a 404 status code:
http.response.code == 404
The configuration adds the request to the "not_found_requests" zone, using the client's IP as the key:
rate_limit.add_zone:
zone: "not_found_requests"
key:
- type: "ip"
This configuration enables rate limiting of clients that frequently request non-existent resources.
graph TD
A[Response Generated] --> B[rate_limit.add_zone in Response Phase]
B --> C[Next Request]
C --> D[rate_limit.check_zone in Request Phase]
D -->|Within limit| E[Continue Processing]
D -->|Limit exceeded| F[Apply Action]
F --> G[Block/Challenge/Log]
The Rate Limit Response phase provides access to the following fields:
The separation of rate limiting into Request, Request Late, and Response phases provides several benefits:
This multi-phase approach enables the implementation of complex rate limiting strategies that consider the full request-response cycle.