Redirecting tomcat to a public URL in lieu of local server IP

I ran into an issue recently where an App team requested help making an Apache change to redirect their apache instance to their public URL that we serve off of our F5.. I don’t do this often so I feel the need to document what I have done to get this to work.

  1. Find the apache installation folder and server.xml file in my case /ds1/apache-tomcat-7.0.59/conf/server.xml

NOTE: Make a backup of your file in case you mess up.


cp server.xml server.xml.ori


2. Using your favorite editor open up the file


[root@somehost ~]# vi /ds1/apache-tomcat-7.0.59/conf/server.xml

3.  Locate the connector section of your conf file. Mine started on line 71


     71     <Connector port="8080" protocol="HTTP/1.1"
     72                connectionTimeout="20000"
     73                redirectPort="8443" />

4.  Add the following underneath line 71 or underneath the <Connector port=”8080″ protocol=”HTTP/1.1″ line where ever this may live for you.



5.  Remove the line redirectPort=”8443″ from the connector and close the connector next to the “secure=”true” section. Your finished product should look like this:

    <Connector port="8080" protocol="HTTP/1.1"
               secure="true" />

6. If your app needs to be started as a specific user su over to that user at this point and issue a restart of the tomcat installation. And you will no longer have a tomcat instance that uses internal only links.

Leave a Reply

Your email address will not be published.