KrakenD Enterprise 2.0 released! Read the Release notes »

Community version (v2.0.4)

Recent changes

HTTP handler plugins

HTTP handler plugins

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.

What is a Handler?
A Handler responds to an HTTP request, and is an interface modeling an HTTP processor.

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:

http handler plugin

HTTP handler interface

Writing plugins
Read the introduction to writing plugins for compilation and configuration options if you haven’t done it yet.

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:

Unresolved issues?

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