Configuring Tomcat to use a Proxy server

This document (3725347) is provided subject to the disclaimer at the end of this document.

Environment

Novell NetWare 6.0
Novell NetWare 6.5
Novell Open Enterprise Server (OES)
Novell Portal Services 1.5
Novell exteNd Director 4.1 Standard Edition
Tomcat 3.3
Tomcat 4.1.18
Tomcat 5.0
Novell iManager

Situation

This document describes how to configure Tomcat to use a proxy server

Resolution

Please see additional notes for other options, such as setting proxy usernames.

** For TOMCAT 3.3 **

To enable TOMCAT 3.3 on a NetWare server to use proxy, you must first modify the sys:\tomcat\33\bin\TOMCAT33.NCF file with the necessary parameters. The definitions should be added to the end of the NCF file that starts TOMCAT, not on the LOAD JAVA line. Add them to the last line in the file that actually starts up Tomcat.
Example:

java -envCWD=$TOMCAT_HOME -classpath $TOMCAT_CLASSPATH -Dhttp.proxyHost=192.168.1.1 -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=-Xms256m -Xmx300m -dtomcat.home=SYS:\tomcat\33 org.apache.tomcat.startup.Main -f sys:/tomcat/33/conf/nwserver.xml %1

If you want to use a TOMCAT_OPTS environment variable, you can also add $TOMCAT_OPTS in the above line anywhere before the org.apache.tomcat.startup.Main. A memory flag can also be used within this CONF file. In the above example -XMS254M -XMX300M is an example of a memory flag

** For TOMCAT 4.1 **

To enable TOMCAT 4.1 on a NetWare server to use proxy, you must first modify the edit sys:\tomcat\4\bin\TOMCAT4.ncf file with the necessary parameters. The definitions should be added to the CATALINA_OPTS variable, not on the LOAD JAVA line. The line setting the CATALINA_OPTS variable should become something like this:

setenv CATALINA_OPTS = -Dhttp.proxyHost=proxy.mydomain.com -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=192.168*|10.1.*

Where:
-Dhttp.proxyHost is the dns name or ip of proxy server
-Dhttp.proxyPort is the proxy port number
-Dhttp.nonProxyHosts are the local addresses not to be routed to proxy

UPDATE for OES Linux servers:

For Linux OES, the following changes must be made:

1. In the file /opt/novell/tomcat4/bin/dtomcat4 find the line that sets the environmental variable CATALINA_OPTS.

2. Add the following three lines:
CATALINA_OPTS="$CATALINA_OPTS -Dhttp.proxyHost=proxyhost"
CATALINA_OPTS="$CATALINA_OPTS -Dhttp.proxyPort=proxyport"
CATALINA_OPTS="$CATALINA_OPTS -Dhttp.nonProxyHosts=ip subnet"

3. Restart TOMCAT4 - /etc/init.d/novell-tomcat4 restart - after making the edits.

For Linux OES2, the following changes must be made:

1. In the file /etc/sysconfig/j2ee find the line that sets the environmental variable CATALINA_OPTS.

2. Add the following three lines:
CATALINA_OPTS="$CATALINA_OPTS -Dhttp.proxyHost=proxyhost"
CATALINA_OPTS="$CATALINA_OPTS -Dhttp.proxyPort=proxyport"
CATALINA_OPTS="$CATALINA_OPTS -Dhttp.nonProxyHosts=ip subnet"

3. Restart TOMCAT5 - /etc/init.d/novell-tomcat5 restart - after making the edits.

Additional Information

For additional information on setting the java properties: http.proxyHost and http.proxyPort refer to http://java.sun.com/docs/books/tutorial/networking/urls/_setProxy.html

Formerly known as TID# 10067182

To set a proxy username and a proxy password, similar to adding the -Dhttp.proxyHost=hostname parameter, two other parameters can be added. -Dhttp.proxyUser=username and -Dhttp.proxyPassword=supersecret can be added in a similar fashion to enable authentication for the proxy requests.

Document

Document ID:3725347
Creation Date:11-06-2007
Modified Date:12-24-2008
Novell Product:Apache
Novell Product:BorderManager
Novell Product:exteNd
Novell Product:iManager
Novell Product:NetWare

Disclaimer

The Origin of this information may be internal or external to Novell. Novell makes all reasonable efforts to verify this information. However, the information provided in this document is for your information only. Novell makes no explicit or implied claims to the validity of this information.
Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark information.