Connect to an Endpoint via a Proxy

There can be certain scenarios where Microgateway has to connect to the backend service via a proxy server. This can be due to the reason that Microgateway sits behind a firewall and the egress (outgoing) traffic from Microgateway is only allowed via a proxy server. For those cases, Microgateway should be able to configure to connect to the backend service via the proxy server.

Configure the proxy server

The common set of configurations that are used when connecting with upstream backend services can be found under the section httpClients of the <MICROGW_HOME>/conf/micro-gw.conf file. [httpClients.proxy] section describes the proxy related configurations. The following config section should be added to micro-gw.conf file in order to configure the proxy server.

[httpClients]
  [httpClients.proxy]
    enabled = true
    host = "localhost"
    port = 3128
    username = ""
    password = ""
    enableInternalServices = true

The configurations are described in the table below.

Property Description
enabled Enables or disable via connecting a proxy server to the upstream endpoints.
host Hostname or IP address of the proxy server.
port Port of the proxy server
username Username of a valid user if the proxy server is secured using basic authentication.
password Passwrod of the corresponding user.
enableInternalServices Whether to enable the proxy server when communicating with analytics server, key manager, traffic manager and etc.

Note

This config is applicable for following scenarios.

1. The client used to communicate with key manager for token validation
2. The client used to publish throttle events to the traffic manager component of WSO2 API Manager
3. The client used to communicate with etcd server for service discovery
4. The client used to communicate with WSO2 Analytics server to upload analytics event written files
5. The client used to communicate with etcd server to get updates regarding revoked jwt tokens
Top