I have an apache server on an linux system (on amazon aws), running with https. I also have an tomcat on it. I want to use the apache as a front door to the tomcat. I enabled the mod_proxy module for the apache and the redirection to the tomcat works fine and looks like this:
<VirtualHost *:80>
ServerName my.domain.com
#Log
ErrorLog /var/log/ajp.error.log
CustomLog /var/log/ajp.log combined
#AJP configuration
<Proxy *>
Order deny,allow
Deny from all
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
</VirtualHost>
I added this lines at the bottom of my file httpd.conf in /etc/httpd/conf.d folder.
But if I add another VirtualHost in the httpd.conf file to redirect to https, the redirection to https works but the apache Test page will be shown, not the tomcat page. If I remove this redirection VirtualHost the apache tomcat page will be shown. I also enabled the mod_rewrite module. The https stuff I configured in ssl.conf (/etc/httpd/conf.d/ssl.conf) and it works fine. There I setup the ssl certificates and if the client make an request with an known https certificate the server will answer the request. Else not.
The VirtualHost for the https redirection I added to the httpd.conf looks like this:
<VirtualHost *:80>
ServerName my.domain.com
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>
Can you please help me? What I am doing wrong here? Should I make changes in the /etc/httpd/conf.d/ssl.conf file? I am very
Okay, now I got the solution for that problem. I wrote this lines at the bottom of the /etc/httpd/conf.d/ssl.conf, before VirtualHost ends:
#Log
ErrorLog /var/log/ajp.error.log
CustomLog /var/log/ajp.log combined
#AJP configuration
<Proxy *>
Order deny,allow
Deny from all
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/