Summary 


If the Tomcat server will use a proxy server to connect to the Internet, you need to configure Tomcat with the appropriate proxy settings. This article provides the instructions.

Details
Specify the IP address and port of the proxy servers in Tomcat Java settings with the following:

-Dhttp.proxyHost=
-Dhttp.proxyPort=
-Dhttps.proxyHost=
-Dhttps.proxyPort=

For example, the following environment options configure Tomcat to use a proxy server with IP 192.168.0.10 through port 1234:
-Dhttp.proxyHost=192.168.0.10
-Dhttp.proxyPort=1234
-Dhttps.proxyHost=192.168.0.10
-Dhttps.proxyPort=1234

NOTE: In Windows, you can also add these options from the Configure Tomcat shortcut and set them in the list under Java > Java Options.

Configure Tomcat to use a proxy server in a Windows environment

1.Create a file named setenv.bat in the $CATALINA_HOME/bin folder.
2.Enter the following lines:

set CATALINA_OPTS=%CATALINA_OPTS% -Dhttp.proxyHost=192.168.0.10
set CATALINA_OPTS=%CATALINA_OPTS% -Dhttp.proxyPort=1234
set CATALINA_OPTS=%CATALINA_OPTS% -Dhttps.proxyHost=192.168.0.10
set CATALINA_OPTS=%CATALINA_OPTS% -Dhttps.proxyPort=1234

3. Replace the IP and port numbers with those of your proxy servers.
4. Restart the Tomcat Server.

Configure Tomcat to use a proxy server in a Linux environment

1.Create a file named setenv.sh in the $CATALINA_HOME\bin folder.
2. Enter the following lines:

export CATALINA_OPTS="$CATALINA_OPTS -Dhttp.proxyHost=192.168.0.10"
export CATALINA_OPTS="$CATALINA_OPTS -Dhttp.proxyPort=1234"
export CATALINA_OPTS="$CATALINA_OPTS -Dhttps.proxyHost=192.168.0.10"
export CATALINA_OPTS="$CATALINA_OPTS -Dhttps.proxyPort=1234"

3. Replace the IP and port numbers with those of your proxy servers.
4. Restart the Tomcat Server.