Configuring Apache Tomcat to use HTTP/TCP proxy

You must modify the Java virtual machine (JVM) so that Apache Tomcat can use an HTTP/TCP proxy. You can configure Apache Tomcat by configuring JVM options in the Tomcat startup script.

Before you begin

You must have the required privileges to edit the Apache Tomcat startup script.

Procedure

  1. Locate the Tomcat startup script.
    The location of the script depends on the OS you are using. The location can be as follows:
    • In Microsoft Windows, at %CATALINA_HOME%\bin\catalina.bat
    • In Unix-like systems, at $CATALINA_HOME/bin/catalina.sh
  2. Open the catalina.sh file for editing and add the following JAVA_OPTS option for the proxy:
    JAVA_OPTS="-Dhttp.proxyHost=<Hostname or IP address of HTTP/TCP proxy>-Dhttp.proxyPort=<Port number specified during installation>-Dhttps.proxyHost=<Hostname or IP address of HTTP/TCP proxy>-Dhttp.proxyPort=<Port number specified during installation>-Djavax.net.ssl.trustStore=/opt/tomcat/bin/greenhat.jks -Djavax.net.ssl.trustStorePassword=passphrase"
    Note: If you are setting up a HTTP/TCP proxy to support both HTTP and HTTPS, use the properties as http.proxyHost for the HTTP proxy and https.proxyPort for the HTTPS proxy.

    For example, if you have installed Rational® Test Control Panel on a computer with the IP address as 101.25.87.99 and are using the default port 3128 for both HTTP and HTTPS, the options you set in the catalina.sh file are as follows:

    JAVA_OPTS="-Dhttp.proxyHost=101.25.87.99 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=101.25.87.99 -Dhttps.proxyPort=3128 -Djavax.net.ssl.trustStore=/opt/tomcat/bin/greenhat.jks -Djavax.net.ssl.trustStorePassword=passphrase"

  3. Save and close the file.
  4. Restart Tomcat for the changes to take effect.