Solved

Apache vhost RedirectMatch and ajp13 problem

Posted on 2008-06-20
2
1,170 Views
Last Modified: 2013-12-02
hi
I have a an apache 2.0.52 connected to tomcat 5.5.25 using JkMount  ajp13 connector.

Now I have 2 vhosts configured for my domain one listing on port 80 and the other listening on port 443

I am transfering all the requests from apache to tomcat using JkMount /* ajp13.
Now my requirement is I need to transfer all the requests to tomcat except a coulple of pages like login.jsp.
The request for login.jsp should be redirected to the vhost listening on the ssl port 443.
Usually this can be done by using Redirectmatch or Redirect but because I am using JkMount /* ajp13
it overrides the Redirectmatch entry for login page.

Could you please tell me how give the Redirectmatch prefrence over JkMount /* ajp13.
Requests for all other pages except login.jsp should be sent to tocmat. I do not wish to use apache for server static content.
Please find the two virtual host entries in the code snippet.


NameVirtualHost 64.151.81.100:80 
NameVirtualHost 64.151.81.100:443 
 
 
# apache configuration
 
<VirtualHost 64.151.81.100:443>
 
	ServerName www.drdenisetarasuk.egenhealth.com
 
	ServerAlias drdenisetarasuk.egenhealth.com *drdenisetarasuk.egenhealth.com
	
	SSLEngine On
 
	SSLCertificateFile    /etc/httpd/conf/ssl.crt/drdenise.crt
       SSLCertificateKeyFile /etc/httpd/conf/ssl.key/drdenise.key
 
	
	
 
	ServerAdmin manoj@egenhealth.com.com
	DocumentRoot /home/virtual/site6/fst/var/www/html
 
	JkMount /* ajp13
	RewriteEngine on
	suexecUserGroup admin6 admin6
 
	
 
	
 
	<Directory /home/virtual/site6/fst/var/www/html/>
		Allow from all
		AllowOverride All
		Order allow,deny
	</Directory>
 
	<Directory /home/virtual/site6/fst/home/*/public_html/>
		Allow from all
		AllowOverride All
		Order allow,deny
	</Directory>
 
	SetEnv SITE_ROOT /home/virtual/site6/fst
	SetEnv SITE_HTMLROOT /home/virtual/site6/fst/var/www/html
 
        <IfModule mod_php4.c>
                # need to set php on explicitly (PR 24077).
                # using php_flag so site can override.
                php_flag engine on
		# php_admin_value sendmail_path  "/usr/sbin/sendmail -t -i -f %s@%s"
        </IfModule>
        <IfModule sapi_apache2.c>
                php_flag engine on
		# php_admin_value sendmail_path  "/usr/sbin/sendmail -t -i -f %s@%s"
        </IfModule>
 
        <Directory /home/virtual/site6/fst/var/www/interpreters>
                Options ExecCGI
                SetHandler cgi-script
        </Directory>
        Alias /interpreters/ /home/virtual/site6/fst/var/www/interpreters/
 
	
</VirtualHost>
 
 
 
 
 
<VirtualHost 64.151.81.100:80>
 
	
	ServerName www.drdenisetarasuk.egenhealth.com
 
	ServerAlias drdenisetarasuk.egenhealth.com *drdenisetarasuk.egenhealth.com
	
	RedirectMatch permanent ^/(.*)login\.jsp$ https://www.egenhealth.com/$1 
 
 
	ServerAdmin manoj@egenhealth.com.com
	DocumentRoot /home/virtual/site6/fst/var/www/html
	#JkMount /*.jsp ajp13
	JkMount /* ajp13
	RewriteEngine on
	suexecUserGroup admin6 admin6
 
	
 
	
 
	<Directory /home/virtual/site6/fst/var/www/html/>
		Allow from all
		AllowOverride All
		Order allow,deny
	</Directory>
 
	<Directory /home/virtual/site6/fst/home/*/public_html/>
		Allow from all
		AllowOverride All
		Order allow,deny
	</Directory>
 
	SetEnv SITE_ROOT /home/virtual/site6/fst
	SetEnv SITE_HTMLROOT /home/virtual/site6/fst/var/www/html
 
        <IfModule mod_php4.c>
                # need to set php on explicitly (PR 24077).
                # using php_flag so site can override.
                php_flag engine on
		# php_admin_value sendmail_path  "/usr/sbin/sendmail -t -i -f %s@%s"
        </IfModule>
        <IfModule sapi_apache2.c>
                php_flag engine on
		# php_admin_value sendmail_path  "/usr/sbin/sendmail -t -i -f %s@%s"
        </IfModule>
 
        <Directory /home/virtual/site6/fst/var/www/interpreters>
                Options ExecCGI
                SetHandler cgi-script
        </Directory>
        Alias /interpreters/ /home/virtual/site6/fst/var/www/interpreters/
 
	
 
 
 
</VirtualHost>

Open in new window

0
Comment
Question by:manoj2066
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 27

Accepted Solution

by:
caterham_www earned 500 total points
ID: 21941645
If there's no way to exclude certain files via mod_jdk - you may also try mod_rewrite instead of mod_alias (see below [1]) - I wouldn't use mod_jdk as the connector at all in favor of mod_proxy, mod_proxy_ajp (apache httpd version 2.1 and later) in conjunction with mod_rewrite's P-Flag [2].

[1]
JkMount /* ajp13
RewriteEngine on
RewriteRule ^/(.*)login\.jsp$ https://www.egenhealth.com/$1 [R=301,L]

-----------
[2]
RewriteEngine on
RewriteRule ^/(.*)login\.jsp$ https://www.egenhealth.com/$1 [R=301,L]
RewriteRule ^/(.*) ajp://localhost:8000/$1 [P]
ProxyPassReverse / ajp://localhost:8000/
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
exchange 2010 turning off 3des ciphers 2 452
Apache error.log 19 73
Redirect to catagorie in case of 404 4 32
Rdp session freeze periodically in FORTIGATE ssl vpn 2 78
This exercise is about for the following scenario: Dmgr and One node with 2 application server. Each application server contains it owns application. Application server name as follows server1 contains app1 server2 contains app1 Prereq…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question