Skip to main content
Feedback

Filter by header quota

Filter by header quota enables precise control over API usage by setting limits based on request headers, rather than just URLs. This enables flexible quota management, such as distinguishing between environments or customer tiers, ensuring resources are allocated efficiently and tailored to specific needs.

Group configuration: Production versus staging

The following setup defines separate quotas for production and staging user groups, with different quota limits. The production group receives a higher quota than the staging group to reflect the greater resource needs of production environments.

/etc/lunar-proxy/quotas/{fileName}.yaml
quotas:
- id: LimiterMonth
filter:
url: api.website.com/* # Or an IP address such as X.X.X.X/*
strategy:
fixed_window:
static:
max: 10000000
interval: 1
interval_unit: month
monthly_renewal:
day: 1
hour: 11
minute: 0
second: 0
timezone: UTC

internal_limits:
- id: ProductionQuota
parent_id: LimiterMonth
filter:
headers:
- key: x-lunar-consumer-tag
value: production
strategy:
fixed_window:
static:
max: 10000
interval: 1
interval_unit: day

- id: StagingQuota
parent_id: LimiterMonth
filter:
headers:
- key: x-lunar-consumer-tag
value: staging
strategy:
fixed_window:
static:
max: 2000
interval: 1
interval_unit: day
On this Page