Skip to content

Plugins in Sushi Gateway

Plugins are modular extensions that enhance the gateway's functionality. They can be used for tasks such as authentication, rate limiting, transformations, and more. Each plugin operates within a middleware chain, allowing precise control over how requests and responses are processed.

What are Plugins?

Plugins are:

  • Reusable components that add features to services and routes.
  • Configurable to meet specific API requirements.
  • Applied at different scopes (global, service, route) for fine-grained control.

TIP

Learn about plugin fields and configurations in the Plugin Entity Documentation.

Plugin Middleware Chain

Plugins in Sushi Gateway operate in a defined middleware chain:

  1. Global Plugins: Applied to all services and routes.
  2. Service-Level Plugins: Applied to all routes within a specific service.
  3. Route-Level Plugins: Applied to individual routes, overriding service and global plugins if applicable.

Plugin Priority

The table below illustrates the priority of specific plugins in Sushi Gateway. Plugins with higher priority values are executed earlier in the middleware chain.

PriorityPlugin
2500Bot Protection
2000Cross Origin Resource Sharing (RFC 6454)
1600Mutual Transport Layer Security (RFC 8705)
1450JSON Web Token (RFC 7519)
1250API Key Authentication
1100Basic Authentication (RFC 7617)
951Request Size Limit
950Access Control List
910Rate Limit
12HTTP Log

TIP

Use route-level plugins for the highest level of specificity and ensure priority alignment with your gateway logic.

Available Plugins

Sushi Gateway supports several plugins. Currently, there are 10 plugins available. The table below provides an overview:

Plugin NameDescriptionDocumentation
bot_protectionProtects against automated bots.Bot Protection Plugin
corsManages CORS policies for APIs.CORS Plugin
mtlsImplements mutual TLS authentication.mTLS Plugin
jwtValidates JSON Web Tokens (JWT).JWT Plugin
key_authSecures APIs using API Key Authentication.API Key Plugin
basic_authSecures routes with basic authentication.Basic Auth Plugin
request_size_limitLimits the size of incoming requests.Request Size Limit Plugin
aclManages access control lists for API consumers.Access Control List Plugin
rate_limitControls request rates for clients.Rate Limiting Plugin
http_logLogs HTTP requests and responses for monitoring purposes.HTTP Log Plugin

TIP

Click on a plugin name to learn more about its configuration and use cases.

Example Plugin Configuration

Here’s how to configure a rate_limit plugin:

json
{
  "name": "rate_limit",
  "enabled": true,
  "config": {
    "limit_second": 10,
    "limit_min": 100,
    "limit_hour": 1000
  }
}

Explanation

  • name: The plugin type (e.g., rate_limit).
  • enabled: Toggles the plugin on or off.
  • config: Plugin-specific settings.

Tips for Using Plugins

TIP

Combine multiple plugins at the route level to customize behavior for specific APIs.

Released under the MIT License.