The HTTP handler plugins (or HTTP server plugins) belong to the router layer and let you modify the requests before KrakenD starts processing them, or modify the final response back to the user. The HTTP handler plugin allows you to write your own server right in KrakenD and lets you implement anything you can imagine. This plugin type is so powerful that can be used to implement custom monetization, tracking, tenant control, special protocol conversion, and heavy modifications to put a few examples.
From KrakenD’s perspective, your handler plugins are black boxes that expose an http.Handler
, and you can do anything you want inside. Each plugin is wrapping the next element in the pipe, meaning that for some operations, it must deal with an HTTP request and response writer. If you chain several plugins you will add two extra cycles of decoding and encoding the body:
To start with a hello world for your first plugin you have to implement the plugin server interface by copying the example provided in the Go documentation:
The documentation is only a piece of the help you can get! Whether you are looking for Open Source or Enterprise support, see more support channels that can help you.
We use cookies to understand how you use our site and to improve your overall experience. By continuing to use our site, you accept our Privacy Policy. More information