My situation is the following:
I have an Apache Server in front of a Tomcat that serves plain HTML.
I want to configure SSL in Apache and keeps Tomcat serving plain HTML.
I want keep working both protocols, HTTP and HTTPS.
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" />
Now, I have this situation:
- https://example.com--> https://example.com/app (Apache to Tomcat is working OK).
The problem is that Spring returns a HTTP redirect instead HTTPS.
How can I keep these redirects into the HTTPS protocol?
Thanks in advance
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"/>