Configuring HTTP proxy on clients

Problem: A virtual service is created on a proxy agent and the user is unable to record messages.

Solution: Configure the HTTP Proxy on clients.

All examples below of specific client configurations are using the proxy server HTTP(S) Proxy Agent listening on address hostname with port 6071.

HTTP proxy in .NET Client

The .NET client can be configured to use a default proxy server or a specific proxy server.

If using the default proxy server, take HTTP Proxy Agent settings to configure the default proxy server. Search for Proxy in the Windows Network & internet settings. You must then configure the client to use the default proxy. This is set in the application configuration file. For an application in the <defaultProxy> element :

<configuration>
   <system.net>
     <defaultProxy enabled="true">
       <proxy usesystemdefault="true"/>
     </defaultProxy>
   </system.net>
</configuration>
For a specific binding in a binding element, use:
<configuration>
   <system.serviceModel>
       <bindings>
          <basicHttpBinding>
            <binding name="myHttpBinding" bypassProxyOnLocal="false" useDefaultWebProxy="true">
            </binding>
          </basicHttpBinding>
        </bindings>
   </system.serviceModel>
</configuration>

The same configuration file can be used to set a specific proxy server. This is an example of client configuration for application:

<configuration>
   <system.net>
     <defaultProxy enabled="true">
       <proxy proxyaddress="http://hostname:6071"/>
     </defaultProxy>
   </system.net>
</configuration>

For a specific binding, use:

<configuration>
   <system.serviceModel>
     <bindings>
       <basicHttpBinding>
         <binding name="myHttpBinding" bypassProxyOnLocal="false" useDefaultWebProxy="false" proxyAddress=" http://hostname:6071">
         </binding>
       </basicHttpBinding>
     </bindings>
   </system.serviceModel>
</configuration>

HTTP proxy in Java Client

The proxy settings for Java client are given to the JVM via command line arguments. This is an example of how to run the client from the command line with proxy configuration:

java -Dhttp.proxyHost=hostname -Dhttp.proxyPort=6071 MyJavaClient

HTTP proxy in WebLogic

Add the Java proxy parameters to Java options in JAVA_OPTIONS environment variable in the proper section of script %WL_HOME%\common\bin\commEnv.cmd for MS Windows or in ${WL_HOME}/common/bin/commEnv.sh for Unix/Linux. This is example of setting the proxy configuration.

  • Windows: Edit the file commEnv.cmd

    set JAVA_OPTIONS=%JAVA_OPTIONS% -Dhttp.proxyHost=hostname -Dhttp.proxyPort=6071

  • Linux: Edit the file commEnv.sh

    JAVA_OPTIONS="${JAVA_OPTIONS} -Dhttp.proxyHost=hostname -Dhttp.proxyPort=6071

HTTP proxy in WebSphere

The HTTP proxy on the WebSphere application server can be configured via setting transport properties http.proxyHost and http.proxyPort.

To set the HTTP transport properties:

  1. Using wsadmin.

  2. Using an assembly tool.

  3. Using the JVM custom property panel in the administrative console.

To learn more about (1) and (2), see the Configuring additional HTTP transport properties in WebSphere documentation.

To configure the HTTP proxy properties using the administrative console:

  1. Open the administrative console.

  2. Click Servers > Application Servers > server > Java and Process Management > Process definition > Java Virtual Machine > Custom Properties.

  3. (Optional) If the property is not listed, create a new property name.

  4. Enter the name http.proxyHost and value hostname.

  5. Enter the name http.proxyPort and value 6071.

  6. Restart the server.

HTTP proxy in JBoss

Add the Java proxy parameters to Java options in JAVA_OPTS environment variable in the startup script %JBOSS_HOME%\bin\run.bat or run.conf.bat for MS Windows or in ${JBOSS_HOME}/bin/run.sh or run.conf for Unix/Linux. This is an example of setting the proxy configuration in JAVA_OPTS environment variable:

  • Windows: Edit the file run.conf.bat

    set "JAVA_OPTS=-Dhttp.proxyHost=hostname -Dhttp.proxyPort=6071

  • Linux: Edit the file run.conf

    JAVA_OPTS="-Dhttp.proxyHost=hostname -Dhttp.proxyPort=6071