News KrakenD CE v2.6 released with OpenTelemetry

Enterprise Documentation

Recent changes

You are viewing a previous version of KrakenD Enterprise Edition (v2.2) , go to the latest version

HTTP Proxy: Access to backends through a proxy

Document updated on Jan 20, 2023

Starting from version v2.3, this component is no longer being developed and has been marked as deprecated. As a result, it will not receive any updates and will be removed in future releases. It has been replaced by backend/http/client, check the latest documentation.

The HTTP proxy plugin adds an intermediate layer where the connection to the backend goes through an external proxy.

There are two different ways to connect to your backends through a corporate proxy:

  • Connect to all backends using a proxy
  • Connect to a specific backend using a proxy

Connecting to all backends using a proxy

Passing an environment variable HTTP_PROXY when starting the gateway ensures that all backend requests pass through the defined proxy. For instance:

Term 
$docker run --rm -v "$PWD:/etc/krakend" -e HTTP_PROXY=http://myproxy:8080 krakend/krakend-ee

Connecting to a specific backend using a proxy

If instead, you want to route a single backend connection through a proxy, you must add a plugin entry to the desired backend as follows:

{
    "version": 3,
    "plugin": {
        "pattern": ".so",
        "folder": "/opt/krakend/plugins/"
    },
    "endpoints": [
        {
            "endpoint": "/health",
            "output_encoding": "no-op",
            "backend": [
                {
                    "url_pattern": "/__health",
                    "host": ["http://localhost:8080"],
                    "encoding": "no-op",
                    "extra_config": {
                        "plugin/http-client": {
                            "name": "http-proxy",
                            "proxy_address": "http://myproxy:8080"
                        }
                    }
                }
            ]
        }
    ]
}

The configuration flags relative to the plugin are:

  • proxy_address (string): The proxy address used to forward the traffic. The address must contain the protocol and the port.
Scarf

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.