SSL connection to Tomcat (behind Apache – mod_jk)

apache-2.2mod-jkssltomcat

The SSL connection is working for every page on the Apache server except these served to Tomcat. Tomcat works well on http connection.

The setup:

  • Apache/2.2.21
  • Tomcat-7.0.23
  • mod_jk to connect them
  • self-signed certificate

What is working

If I try to connect to tomcat through http everything is OK. Every page which is specified in the JkMount directive is forward to Tomcat and all the others pages are Apache's responsibility. I have two virtual hosts – one for port 80 and one for 443. The working configuration for 80 is:

<VirtualHost *:80>
ServerName *******

JkMount /cas ajp13_worker
JkMount /cas/* ajp13_worker

</VirtualHost>

What is my problem

When I try to use https with similar vhost configuration for port 443 – there is an entry in the apache logs:

File does not exist: ****/apache2/htdocs/cas

Configuration files

The settings for vhost on port 443:

<VirtualHost ****:443>
ServerName *******

JkMount /cas ajp13_worker
JkMount /cas/* ajp13_worker

</VirtualHost>

In the httpd.conf the section for mod_jk is:

JkWorkersFile ****/tomcat-7.0.23/conf/workers.properties
JkLogFile ****/apache2/logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

(I've read that I need the following lines ... )
JkExtractSSL On
JkHTTPSIndicator HTTPS
JkSESSIONIndicator SSL_SESSION_ID
JkCIPHERIndicator SSL_CIPHER
JkCERTSIndicator SSL_CLIENT_CERT

In httpd-ssl.conf I've specified the certificate paths … https is working correctly for all pages except the Tomcat ones.

DocumentRoot is specified in httpd.conf.

Questions

What is controlling whether the Apache is searching in DocumentRoot dir or forwarding the requests to Tomcat? What am I doing wrong?

Thank you 🙂

Best Answer

Check the output of apache2ctl -S - a second SSL vhost that is loading first on the port will get requests instead of the desired vhost.