The OrganizationMonitor middleware is part of Tyk’s middleware chain and is responsible for enforcing organization-level quotas and activity monitoring. It ensures that requests are only processed if the organization is active and within its consumption limits.
Organization monitoring is controlled by the environment variable: TYK_GW_ENFORCEORGQUOTAS
Enabled (true) → The Gateway enforces quotas and rate limits for organizations. Logs will show entries from OrganizationMonitor.
Disabled (false) → Quotas and rate limits are not enforced, and the middleware is skipped entirely.
How it works:
- Session Validation
a. Looks for an organization session in cache
b. If none, it will then check in Redis
c. Lastly, confirms the organization is active - Quota & Rate Limit Enforcement
a. Applies consumption limits (quota and rate limit)
b. If necessary, updates session - Error Handling
a. If validation fails, an error is returned based on the sessionFail reason
b. If successful, the request proceeds to the next middleware in the chain.
The implementation can be found in the Tyk Gateway repository: https://github.com/TykTechnologies/tyk/blob/f5802a7018d71238cd937d15e18bbc5a2dea2637/gateway/mw_organisation_activity.go
Comments
0 comments
Article is closed for comments.