0

My situation is the following:

  1. I have an Apache Server in front of a Tomcat that serves plain HTML.

  2. I want to configure SSL in Apache and keeps Tomcat serving plain HTML.

  3. I want keep working both protocols, HTTP and HTTPS.

  4. My actual configuration is like this:

I enable a new virtual host:

<VirtualHost _default_:443>
          SSLEngine on
          SSLCertificateFile      /etc/apache2/conf/ssl/mydomain.crt
          SSLCertificateKeyFile  /etc/apache2/conf/ssl/mydomain.key
          SSLCertificateChainFile   /etc/apache2/conf/ssl/intermediate_mydomain_ca.crt
          ProxyRequests Off
          ProxyPreserveHost On
          ProxyPass / ajp://localhost:8009/app
          ProxyPassReverse / ajp://localhost:8009/app
    </VirtualHost>

I'm also enable an AJP Connector on Tomcat's port 8009

<Connector port="8009" protocol="AJP/1.3" redirectPort="8080" />
  1. Now, I have this situation:

The problem is that Spring returns a HTTP redirect instead HTTPS.

How can I keep these redirects into the HTTPS protocol?

Thanks in advance

2
  • mod_proxy_ajp should automatically forward the TLS info to Tomcat. That should mean that the protocol information is available to Tomcat. How is the redirect constructed? Nov 2, 2015 at 0:21
  • Finally I solve it. First, in the Virtual Host you have to add that: RequestHeader set X-Forwarded-Proto "https". Then, in server.xml file configure a Valve like this: <Valve className="org.apache.catalina.valves.RemoteIpValve" internalProxies=".*" protocolHeader="X-Forwarded-Proto" httpsServerPort="443"/>
    – Paula
    Nov 16, 2015 at 15:58

0

You must log in to answer this question.

Browse other questions tagged .