Skip to main content
Version: 3.10.x

Plugins

A Plugin is a modular component that intercepts and modifies the request and response flow through the gateway. API7 Gateway includes over 100 enterprise-grade plugins for authentication, traffic control, observability, security, and AI capabilities.

Plugin Execution​

For HTTP requests, plugin handlers run through the following phases in order:

rewrite → access → before_proxy → header_filter → body_filter → log

A plugin runs only in the phases it implements. Within the same phase and execution scope, a plugin with a higher priority runs before one with a lower priority. Changing a priority does not move a handler into an earlier phase. In particular, rewrite runs before access, even when an access handler has a higher priority.

For example, if three plugins on a route have the following handlers, they run in this order:

OrderHandlerPriority
1Plugin A: rewrite500
2Plugin B: access2000
3Plugin C: access1000

The phases above describe a normal proxy request. A plugin can reject a request before it reaches the upstream, and response body filters can run more than once for a streaming response.

Plugin Scopes​

You can apply plugins at different levels of the configuration hierarchy:

  • Route level: Applied to a specific route. Only affects traffic matching that route.
  • Service level: Applied to a Service. Affects all routes within that service.
  • Consumer level: Applied to a specific Consumer. Affects all traffic identified as belonging to that consumer.
  • Global Rule: Applied to an entire Gateway Group. Affects all routes managed by that group.

For non-authentication plugins with the same name, these scopes do not combine their individual fields. A Route configuration replaces the same plugin inherited from its Service. After authentication identifies a Consumer, that Consumer's configuration replaces the effective Route or Service configuration for the same plugin. The entire plugin configuration is replaced, so lists and other fields are not automatically joined or intersected.

Authentication plugins follow a different lifecycle. The Route or Service authentication configuration identifies the Consumer before Consumer plugins are merged, and authentication plugins from the Consumer merge are not run again for the request.

Global Rules are evaluated separately from this replacement process. For example, a consumer-restriction Global Rule and an effective Route, Service, or Consumer configuration can both evaluate the request, and either can reject it. See Access Control Lists for a runnable Consumer-level override example.

Plugin Categories​

API7 Gateway categorizes plugins by their primary function. The following table provides examples of commonly used enterprise plugins:

CategoryExamples
Authenticationkey-auth, jwt-auth, basic-auth, hmac-auth, openid-connect, ldap-auth, multi-auth
Traffic Controllimit-count, limit-req, limit-conn, limit-count-advanced, api-breaker, traffic-split
Transformationproxy-rewrite, response-rewrite, body-transformer, grpc-transcode
Observabilityprometheus, opentelemetry, http-logger, kafka-logger, loki-logger, splunk-hec-logging
Securitycors, ip-restriction, ua-restriction, consumer-restriction, csrf, data-mask, opa, chaitin-waf
AI Gatewayai-proxy, ai-proxy-multi, ai-rate-limiting, ai-rag, ai-prompt-template, ai-prompt-guard
Serverlessaws-lambda, azure-functions, serverless-pre-function, serverless-post-function

Plugin Metadata​

Some plugins require shared configuration across all instances of that plugin type. This is managed via Plugin Metadata. For example, you can define a shared Kafka broker address in the kafka-logger metadata, which all instances of the plugin will then use.

Next Steps​