Working with Proxy Servers

When using WSO2 Micro Integrator, there can be scenarios where you need to configure the Micro Integrator to route messages through a proxy server. For example, if the Micro Integrator is behind a firewall, your proxy service might need to talk to a server through a proxy server.

Routing messages through a proxy server

See the instructions given below.

For non-blocking service calls

To configure the Micro Integrator to route messages through a proxy server (for non-blocking service calls), add the parameters given below to the deployment.toml file and update the values. This configuration ensures that all HTTP requests pass through the configured proxy server.

[transport.http]
sender.proxy_host= "<hostname/ip>"
sender.proxy_port= <port>

For blocking service calls

To configure the Micro Integrator to route messages through a proxy server (for blocking service calls), add the parameters given below to the deployment.toml file and update the values. This configuration ensures that all HTTP requests pass through the configured proxy server.

[transport.blocking.http]
sender.parameter.'http.proxyHost'= "<hostname/ip>"
sender.parameter.'http.proxyPort'= <port>

Info

Bypass the proxy server for blocking calls?
In the case of blocking service calls, you can apply a system property in the Micro Integrator to bypass the proxy server and route messages directly to the hosts that should receive the messages. Explained below are two methods of applying the system property:

  • Set the system property in the product startup script that is located in the MI_HOME/bin/ directory as shown below. Note that the list of host names are separated by the pipe symbol ('|').

    -Dhttp.nonProxyHosts =10.|localhost|127.0.0.1|.\.domain.com \

  • Pass the system property when you start the server as shown below.

    ./micro-integrator.sh -Dhttp.nonProxyHosts =10.|localhost|127.0.0.1|.\.domain.com

Note

A proxy server might require HTTP basic authentication before it handles communication from the Micro Integrator.

Configuring proxy profiles in WSO2 Micro Integrator

When using the Micro Integrator, there can be scenarios where you need to configure multiple proxy servers to route messages to different endpoints. When you need to route messages to different endpoints through multiple proxy servers, you can configure proxy profiles.

To configure proxy profiles in WSO2 Micro Integrator, open the deployment.toml file and define multiple profiles based on the number of proxy servers you need to have:

[[transport.http.proxy_profile]]
target_hosts = [""]
proxy_host = ""
proxy_port = ""
proxy_username = ""
proxy_password = ""
bypass_hosts = [""]

Tip

When you define a profile, it is mandatory to specify the target_hosts, proxy_host and proxy_port parameters for each profile.

Note

Secured HTTP proxy profiles can be configured by following this documentation.

When you configure a proxy profile, following are details of the parameters that you need to define in a <profile> :

Parameter Description Required
targetHosts

A host name or a comma-separated list of host names for a target endpoint.
Host names can be specified as regular expressions that match a pattern. When targetHosts is specified as an asterisks (*), it will match all the hosts in the profile

Yes
proxyHost The host name of the proxy server. Yes
proxyPort The port number of the proxy server. Yes
proxyUserName The user name for the proxy server authentication. No
proxyPassword The password for the proxy server authentication. No
bypass

A host name or a comma-separated list of host names that should not be sent via the proxy server.

For example, if you want all requests to *. sample.com to be sent via a proxy server, but need to directly send requests to hello.sample.com , instead of going through the proxy server, you can add hello.sample.com as a bypass host name.

You can specify host names as regular expressions that match a pattern.

No
Top