Tomcat – Configure Tomcat behind reverseproxy

reverse-proxytomcat

I run a Tomcat 7 server in the local branch of our company. The server was available to public via port 80 and 443. Some days ago the configuration got changed by the HQs admins; Tomcat now needs to be connected by reverse proxy. The HQ admins changed the firewall rules, changed the DNS entry, and configured the reverse proxy. Since they have no experience with tomcat they asked me to change the configuration in order to have Tomcat to listen on 8080 for requests from the reverse proxy.

Tomcat's Connectors are defined as follows:

<Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="443" />
    <Connector
           protocol="HTTP/1.1"
           port="443" maxThreads="400"
           scheme="https" secure="true" SSLEnabled="true"
           keystoreFile="foobar.jks" keystorePass="foo_bar"
           clientAuth="false" sslProtocol="TLS"/>
 <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000" proxyName="server.company.com" proxyPort="443" />

However, when I call the URI from firefox, I get a "redirect error" stating that there is a redirect that can't be finished.
In Tomcats access log there are entries of the following schema:

<revere proxy internal ip> - - [14/Dec/2015:15:52:31 +0100] "GET / HTTP/1.1" 302 -

If I remove the proxyName and proxyPort connector properties, a redirect to the internal server name of tomcat is sent.

Any help solving this issue is appreciated.

Best Answer

Try adding scheme="https" and secure="true" to the connector with port 8080, assuming the reverse proxy is doing SSL offloading.

Related Topic