I need to integrate apache server with tomcat first and then redirect http request to https using apache in localhost.
Explaination:
I am able to integrate the two servers successfully using mod_jk and i have installed the self signed security certificate using mod_rewrite and by specifying the certificate and key in httpd-ssl.conf file. this is the file which i have included in httpd.conf:
# Load mod_jk module
# Update this path to match your modules location
LoadModule jk_module "C:/Program Files/BitNami WAMPStack/apache2/modules/mod_jk.so"
# Where to find workers.properties
# Update this path to match your conf directory location
JkWorkersFile C:/softwares/apache-tomcat-7.0.42/conf/workers.properties
# Where to put jk logs
# Update this path to match your logs directory location
JkLogFile C:/MyProject/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://localhost$1 [R,L]
# Send everything for context /myProject to worker ajp13
JkMount /myProject ajp13
JkMount /myProject/* ajp13
Problem faced: On removing the lines,
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://localhost$1 [R,L]
it successfully displays the page as an http request. But on adding the line, though it redirects to an https request it gives a "Not Found" error. I am not able to figure out how to correct this. I hope i am able to explain the problem. I am new to servers and apache modules so this may be a very lame question but please help me figure this out.
There was a tag "< VirtualHost default:443>" in httpd-ssl.conf file. I added the following statement at the end of the tag and it worked.
<VirtualHost _default_:443>
....
JkMount /myProject ajp13
JkMount /myProject/* ajp13
</VirtualHost>