no-op
Document updated on May 2, 2021
KrakenD no-op
(no-operation), is a special type of encoding that behaves as a proxy by passing the client’s request to the backend as is, and vice-versa.
no-op
to proxy requestsWhen setting no-op
, KrakenD does not inspect the request body
or manipulates it in any way. Instead, when a request to a no-op
endpoint is received, KrakenD directly forwards it to the backend without doing any operation with it.
The proxy pipe (this is from KrakenD to backend) is marked to do no-operation, meaning that KrakenD does not aggregate content, filter, manipulate or any of the other functionalities performed during this pipe. It’s also important to notice that only a single backend is accepted, as the merge operation happens during the proxy pipe.
Employing the same principle, when the backend produces the response, it’s passed back to the client as is, preserving its form: body, headers, status codes and such.
On the other hand, the router pipe’s features (from client to KrakenD) remain unaltered, meaning that for instance you can still rate-limit your end-users or require JWT authorization to name a few examples.
The key concepts of no-op
are:
headers_to_pass
, as they hit the router layer first.querystring_params
, as they hit the router layer first.1:1
relationship between endpoint-backend (one backend per endpoint).no-op
Use no-op
when you need to couple the client with a specific backend without any KrakenD manipulation.
Examples:
Cookie
to the client directly from the backend.no-op
To declare endpoints that go directly to the backend as they are you need to define the no-op
encoding both in the endpoint
and the backend
section, specifically:
"output_encoding": "no-op"
in the endpoint
section"encoding": "no-op"
in the backend
sectionWhen using the no-op encoding remember that the endpoint can only have one backend as KrakenD is not going to inspect or manipulate the response (no merging happens). Also, other pipe options like the concurrent requests, the circuit breaker, or the backend rate-limit specific to the proxy pipe aren’t available (but still have endpoint rate limit -> router pipe).
The following snippet shows an endpoint that is passed to the backend as is. Notice that both the endpoint and the backend have a no-op
encoding. The backend is using KrakenD’s debug endpoint to capture the request in the console:
{
"endpoint": "/auth/login",
"output_encoding": "no-op",
"backend": [
{
"encoding": "no-op",
"host": [ "localhost:8080" ],
"url_pattern": "/__debug/login"
}
]
}
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.