Skip to main content

Plugin overview

A Plugin extends the API Gateway: it authenticates requests, adds security, controls traffic, or transforms requests before they reach the backend. Each plugin belongs to one API Gateway and applies to the scope (Scope) you choose.

Supported plugins​

PluginTypeUse it toGuide
JWT AuthAuthenticationAuthenticate requests with the JSON Web Tokens of Consumers.JWT Auth plugin
OpenID ConnectAuthenticationAuthenticate through an external Identity Provider (Keycloak, Auth0, Google, Okta, and so on) with OAuth 2.0 / OIDC.OpenID Connect plugin
CorsSecurityAdd CORS headers so web pages on another domain can call the API from the browser.CORS plugin
Rate LimitingTraffic ControlLimit the number of requests in a time window.Rate Limiting plugin
Proxy RewriteTransformationRewrite the host, path, method, and headers of requests before they reach the backend.Proxy Rewrite plugin

For the steps, see Add a plugin and the page of each plugin.

Scope​

When you create a plugin, you choose where it applies in the Scope section:

ScopeApplies toApplied to column in the list
GlobalEvery Service, Route, and Consumer of the API Gateway.Global
ScopedOnly the Routes / Services you select with + Add Route / + Add Service.Route, Service, or Route + Service

One plugin can be attached to many Routes / Services. When you add a plugin from the Route or Service detail screen, you either reuse an existing plugin (Select existing plugin) or create a new one (Create new plugin).

Direct and inherited plugins​

The Plugins tab on the Route / Service detail screen has 2 sub-tabs:

Sub-tabMeaning
Explicit PluginPlugins attached directly to the Route / Service you are viewing. You add plugins on this sub-tab.
Implicit PluginPlugins the Route / Service gets from elsewhere, read-only: Global plugins, or plugins attached to the Service that the Route uses through Via Service.

Example: a Rate Limiting plugin is attached to the order-service Service. Every Route that uses Via Service to order-service shows this plugin on the Implicit Plugin sub-tab, so you do not attach it to each Route again.

Plugins and other modules​

ModuleRelation to plugins
RouteTarget of the Scope. The Plugins tab has Explicit Plugin / Implicit Plugin, and you can add plugins there.
ServiceTarget of the Scope. Plugins attached to a Service are inherited by Routes that use Via Service.
ConsumerAuthentication plugins identify requests by the Credentials of Consumers. The Global scope also covers Consumers.
UpstreamPlugins are not attached to an Upstream directly. To apply a plugin to requests sent to an Upstream, attach it to the Route or Service that uses that Upstream.

Common plugin combinations​

Some plugins only work together with other components:

GoalWhat you need
Authenticate requests with JWTThe JWT Auth plugin on the Route / Service + a Consumer with a JWT credential.
Limit requests per customerThe Rate Limiting plugin with limit_by set to consumer + an authentication plugin (JWT Auth, OpenID Connect) on the same Route / Service.
A frontend on another domain calls the API with a tokenThe Cors plugin + JWT Auth, with run_on_preflight of JWT Auth kept at false.
Pass the Consumer name to the backendThe Proxy Rewrite plugin with the $consumer_name variable + an authentication plugin that runs first.

Next steps​

Last updated on