0

My virtual hosts in Apache 2.4 For the regular website on Apache 2.4 port 80

ProxyPreserveHost On ProxyRequests Off ServerName trident.openways.us ServerAlias openways.us/Trident ProxyPass / https://openways.us:8443/Trident ProxyPassReverse / https://openways.us:8443/Trident Redirect Permanent /Trident https://openways.us:8443/Trident

To redirect calls on port 80 to Tomcat SSL

<VirtualHost *:80>  
    ServerName  trident.openways.us  
    ServerAlias openways.us/Trident  
    ProxyRequests on  
    ProxyPreserveHost On  
    <Proxy *>  
        Order deny,allow  
        Allow from all  
    </Proxy>  
     SSLProxyEngine on  
     ProxyPass /Trident  https://openways.us:8443/Trident  
     ProxyPassReverse /Trident  https://openways.us:8443/Trident  
  </VirtualHost>  

My Tomcat server.xml

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

<Connector port="8443" scheme="https" secure="true" SSLEnabled="true"   
           SSLCertificateFile="C:\wamp\bin\apache\Apache2.4.4\conf\extra\openways.us_ssl_certificate.cer"   
           SSLCertificateKeyFile="C:\wamp\bin\apache\Apache2.4.4\conf\extra\_.openways.us_private_key.key"   
           SSLPassword="changeit"   
           SSLCertificateChainFile="C:\wamp\bin\apache\Apache2.4.4\conf\extra\-.openways.us_ssl_certificate_INTERMEDIATE.cer"   
           keyAlias="tomcat" SSLProtocol="TLSv1"/>  

<!-- Define an AJP 1.3 Connector on port 8009 -->  
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />  

Despite different configurations tested, my investigation on the web, I can not get them to work, except when the redirection is done to

http://openways.us:8080/Trident, but then without SSL

Please help recommending me the correct configuration or place to investigate

0

You have

ServerName www.openways.us/Trident
ServerAlias openways.us/Trident

This doesn't match any host as the host never contains any part of the path.

Remove them, first:

ServerName www.openways.us
ServerAlias openways.us

Then, supposedly the lower <VirtualHost *:80> is trying to be the SSL version, but it only uses SSL on its connection to the Tomcat server behind. It doesn't implement SSL to the client at all, i.e.

client <--HTTP(80)--> proxy <--HTTPS(8443)--> tomcat

While both of these would do:

client <--HTTPS(443)--> proxy <--HTTPS(8443)--> tomcat

client <--HTTPS(443)--> proxy <--HTTP(8080)--> tomcat

For that, you'd need to have a HTTPS virtual host, instead.

| improve this answer | |
  • I have tried changing the servers and Virtual host as follows – Jorge Mar 30 '18 at 14:40
  • <VirtualHost *:80> ServerName trident.openways.us ServerAlias openways.us/Trident ProxyRequests on ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> SSLProxyEngine on ProxyPass /Trident openways.us:8443/Trident ProxyPassReverse /Trident openways.us:8443/Trident RedirectMatch ^/$ openways.us/Trident </VirtualHost> – Jorge Mar 30 '18 at 14:40
  • The SSL definitions are in the server.xml configuration, I do not get a correct path to Tomcat – Jorge Mar 30 '18 at 14:42
  • Your Apache won't use certificates from Tomcat configuration. – Esa Jokinen Mar 30 '18 at 15:04
  • Esa, thanks for your comment. Apache has its own definitions and SSL certificates. Tomcat is having separate certificates in the subdomain – Jorge Mar 30 '18 at 17:08
0

I finally investigated many sources in past two days, and reached to configurations that worked perfectly as follows:

First of all

in httpd.conf

LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_ajp_module modules/mod_proxy_ajp.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_scgi_module modules/mod_proxy_scgi.so

in httpd-vhosts.conf

DocumentRoot "C:/wamp/www/openways/"
ServerName www.openways.us
ServerAlias openways.us
<Directory "c:/wamp/www/openways/">
</Directory>
 Redirect Permanent / https://www.openways.us

DocumentRoot "C:\Program Files\apache-tomcat-7.0.84\webapps"
ServerName openways.us
ServerAlias trident.openways.us
ProxyRequests Off
ProxyPass /Trident http://openways.us:8080/Trident/

<Location "/Trident">
  Order allow,deny
  Allow from all
</Location>

DocumentRoot "C:\Program Files\apache-tomcat-7.0.84\webapps"
ServerName openways.us
ServerAlias trident.openways.us
ProxyRequests Off
ProxyPass /Trident https://openways.us:8443/Trident/

<Location "/Trident">
  Order allow,deny
  Allow from all
</Location>

In httpd-ssl.conf

Listen 443

SSLEngine on
SSLCertificateFile "C:\wamp\bin\apache\Apache2.4.4\conf\extra\openways.us_ssl_certificate.cer"
SSLCertificateKeyFile"C:\wamp\bin\apache\Apache2.4.4\conf\extra_.openways.us_private_key.key"
ServerName openways.us
ServerAlias trident.openways.us
ProxyRequests Off
SSLProxyEngine on
SSLEngine On
SSLProxyVerify none
SSLProxyCheckPeerCN off
ProxyPass /Trident https://openways.us:8443/Trident/

<Location "/Trident">  
  Order allow,deny  
  Allow from all  
</Location>  

SSLCACertificateFile
"C:\wamp\bin\apache\Apache2.4.4\conf\extra-.openways.us_ssl_certificate_INTERMEDIATE.cer"

In Tomcat server.xml

connectionTimeout="20000"
redirectPort="8443" />

SSLCertificateFile="C:\wamp\bin\apache\Apache2.4.4\conf\extra\openways.us_ssl_certificate.cer"
SSLCertificateKeyFile="C:\wamp\bin\apache\Apache2.4.4\conf\extra\_.openways.us_private_key.key"
SSLPassword="xxxxxxxx"
SSLCertificateChainFile="C:\wamp\bin\apache\Apache2.4.4\conf\extra\-.openways.us_ssl_certificate_INTERMEDIATE.cer"
keyAlias="tomcat" SSLProtocol="TLSv1"/>


I sincerely hope this solution help others like me in their initial steps to configure SSL certificates and combinations of Apache / Tomcat

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.