Document updated on May 12, 2023
When a backend returns a redirect, the default behavior of KrakenD is to follow the redirection and serve the final content to the user. When you don’t want this behavior and let the end client follow the redirect, you must enable the no_redirect
HTTP client option.
The no_redirect
option is one in the list of HTTP client options in the backend.
By enabling the flag, you can stop KrakenD from following redirections like a 301
.
20x
) code.Example of configuration:
{
"version": 3,
"endpoints": [
{
"endpoint": "/redirect",
"output_encoding": "no-op",
"backend": [
{
"url_pattern": "/__debug",
"encoding": "no-op",
"extra_config": {
"backend/http/client": {
"no_redirect": true
}
}
}
]
}
]
}
Prior to v2.3 the no-redirect
plugin offered this functionality, and is now deprecated as it is supported natively. If you used the plugin you will need to execute the following change in your configuration:
"extra_config": {
- "plugin/http-client": {
- "name": "no-redirect"
+ "backend/http/client": {
+ "no_redirect": true
}
}
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.