title: Tomcat behind Apache httpd via SSL (httpd works, tomcat returns error 500)
body: <p>I have a tomcat, listening on port 8080 and an apache httpd listening on ports 80 and 443.</p>
  
  <blockquote>
    <p>The httpd proxies the client through to tomcat via ajp. This works like a charm.</p>
  </blockquote>
  
  <p>The statement I made - quoted above - is wrong. I mistakenly assumed I set the proxy to use ajp-protocol, but I did really use plain http. <strong>This also lead to the answer of this question.</strong></p>
  
  <p>But if I try to connect via https, I get a secure connection which displays an error 500 that isn't logged <strong>anywhere</strong>. My guess is, that the https-connection to the httpd (443) is working, the ajp-proxy also works, but tomcat expects something I do not know about.</p>
  
  <p>I already tried to connect the proxy to ports 8443 and 8080. In my opinion it would suffice for tomcat to be accessed on port 8080, because all traffic is redirected through httpd anyway.</p>
  
  <p>Here is the configuration:</p>
  
  <p>/etc/apache2/sites-available/default-ssl</p>
  
  <pre><code>&lt;IfModule mod_ssl.c&gt;
      ErrorLog /var/log/apache2/ssl_engine.log
      LogLevel error
  
      NameVirtualHost *:443
  
      &lt;VirtualHost *:443&gt;
              ServerName www.doma.in
              ServerAlias doma.in
  
              ServerSignature Off
              SSLEngine on
  
              SSLCertificateFile /etc/ssl/certs/ssl_certificate.crt
              SSLCertificateKeyFile /etc/ssl/certs/ssl_certificate.key
              SSLCertificateChainFile /etc/ssl/certs/intermediate_ca.crt
  
              ProxyPass / ajp://localhost:8080/ retry=0 timeout=240
              ProxyPassReverse / ajp://localhost:8080/
      &lt;/VirtualHost&gt;
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>/etc/tomcat7/server.xml</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;Server port="8005" shutdown="SHUTDOWN"&gt;
      &lt;Listener className="org.apache.catalina.core.JasperListener" /&gt;
      &lt;Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /&gt;
      &lt;Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /&gt;
      &lt;Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /&gt;
  
      &lt;GlobalNamingResources&gt;
          &lt;Resource name="UserDatabase" auth="Container"                    type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /&gt;
      &lt;/GlobalNamingResources&gt;
  
      &lt;Service name="Catalina"&gt;
          &lt;Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" URIEncoding="UTF-8" redirectPort="8443" /&gt;
  
          &lt;!-- Define an AJP 1.3 Connector on port 8009 --&gt;
          &lt;Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URLEncoding="UTF-8" /&gt;
          &lt;!-- &lt;Connector port="8009" protocol="AJP/1.3" redirectPort="8080" URLEncoding="UTF-8" /&gt; also tried this, but same result. --&gt;
  
          &lt;Engine name="Catalina" defaultHost="localhost"&gt;
              &lt;Realm className="org.apache.catalina.realm.LockOutRealm"&gt;
                  &lt;Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/&gt;
              &lt;/Realm&gt;
  
              &lt;Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true"&gt;&lt;/Host&gt;
          &lt;/Engine&gt;
      &lt;/Service&gt;
  &lt;/Server&gt;
  </code></pre>
  
  <p>Unfortunately I can't provide any logs, because the error does not appear in any of them.</p>
  
  <p>Any ideas on how to make this work?</p>
  
  <p>Sincerely
  z</p>