You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by John Bourke <jo...@mobileinternet.com> on 2008/04/21 21:40:38 UTC
[users@httpd] Redirection issue in a SSL virtual hose
Hi,
I have some applications which are running under Tomcat, in a directory
called "www". The Applications are called "Admin" and "Customer". I use
Apache to redirect and proxy into Tomcat.
I want to access my application using several URLS
<http://www.company.com/Admin> http://www.company.com/
<https://www.company.com/> https://www.company.com/
These should point to <https://www.company.com/Customer>
https://www.company.com/Customer as this is the default customer landing
point. But also I need to use
<http://www.company.com/Customer> http://www.company.com/Customer
<https://www.company.com/Customer> https://www.company.com/Customer
<http://www.company.com/Admin> http://www.company.com/Admin
<https://www.company.com/Admin> https://www.company.com/Admin
So I have set up my redirects for http
<VirtualHost 1.2.3.4:80 >
ServerName <http://www.company.com/> www.company.com
RedirectMatch Permanent ^/Customer(.*)
<https://www.company.com/Customer> https://www.company.com/Customer
RedirectMatch Permanent ^/Admin(.*) <https://www.company.com/Admin>
https://www.company.com/Admin
RedirectMatch Permanent ^/$ <https://www.company.com/Customer>
https://www.company.com/Customer
RedirectMatch Permanent (.*)$ <https://www.company.com/Customer>
https://www.company.com/Customer
</VirtualHost>
<VirtualHost 1.2.3.4:443 >
ServerName <http://www.company.com/> www.company.com
SSLEngine On
SSLCertificateFile conf/ssl/www.company.com.crt
SSLCertificateKeyFile conf/ssl/www.company.com.key
ProxyRequests Off
AllowCONNECT 443
<Location />
Order deny,allow
Allow from all
ProxyPass <http://1.2.3.4:8080/www/>
http://1.2.3.4:8080/www/
ProxyPassReverse <http://1.2.3.4:8080/www/>
http://1.2.3.4:8080/www/
ProxyPassReverse /www/
</Location>
DocumentRoot /usr/local/apache2/htdocs
</VirtualHost>
No problem here the http URLs work OK.
<http://www.company.com/Admin> http://www.company.com/
<http://www.company.com/Customer> http://www.company.com/Customer
<http://www.company.com/Admin> http://www.company.com/Admin
For the https URLs, the following work OK
<https://www.company.com/Customer> https://www.company.com/Customer
<https://www.company.com/Admin> https://www.company.com/Admin
BUT
<https://www.company.com/> https://www.company.com/
Does not work. The request. and of course it should not, as we need
<http://1.2.3.4:8080/www/> http://1.2.3.4:8080/www/Customer
<http://1.2.3.4:8080/www/> http://1.2.3.4:8080/www/Admin
For the Tomcat application
<https://www.company.com/> https://www.company.com/
Results in
<http://1.2.3.4:8080/www/> http://1.2.3.4:8080/www
<http://1.2.3.4:8080/www/Customer>
Which does not point to the Tomcat application.
So what I need is some form of URL rewriting or redirection. I tried adding
a redirect into the SSL virtual host
<VirtualHost 1.2.3.4:443 >
ServerName <http://www.company.com/> www.company.com
RedirectMatch Permanent ^/$ <https://www.company.com/Customer>
https://www.company.com/Customer
I also tried rewriting.
RewriteEngine on
RewriteRule ^/$ /Customer [R,L]
Neither are redirecting or rewriting the request for / into /Customer
So my URL of / proxised to <http://1.2.3.4:8080/www/>
http://1.2.3.4:8080/www/ and gives me an error as my application is not
there.
Any suggestions at how to alias/rewrite/redirect/proxy the root to /Customer
?
Thanks
john