You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Shashidhar Rampally <sh...@gmail.com> on 2008/04/11 19:59:04 UTC
301 permanent redirects in Apache + Tomcat using mod_jk
Hi guys,
I am trying to permanently redirect http://xyz.com to
http://www.xyz.com, which is hosted on Apache2 + Tomcat 5.5.9 with
mod_jk. I am trying to use .htaccess file to do so. So far my efforts
have been unsuccessful!
It looks like one the request is handed over to mod_jk before it gets
handled by mod_rewrite by Apache. What could I be doing wrong? Please
advise.
Thanks,
Shashi
My .htaccess file is as follows, which I've placed in
tomcat/webapps/xyz directory
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^xyz.com [nc]
rewriterule ^(.*)$ http://www.xyz.com/$1 [r=301,nc]
relevant portion of httpd.conf file...
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/workers.properties
JkLogFile /etc/httpd/logs/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %J:%M:%S %Y]"
JkMount /* ajp13
Relevant portion of tomcat/conf/server.xml file...
<Host name="xyz.com" appBase="webapps" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Alias>www.xyz.com</Alias>
<Context path="" docBase="xyz">
</Context>
</Host>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 301 permanent redirects in Apache + Tomcat using mod_jk
Posted by Shashidhar Rampally <sh...@gmail.com>.
I am sorry, I meant I do not know anything about mod_proxy.
On Fri, Apr 11, 2008 at 3:53 PM, Shashidhar Rampally
<sh...@gmail.com> wrote:
> Francis,
>
> Sorry if I offended you.
> Those links are
> www.xyz.com/specsheets.html -> www.xyz.com/specsheet.jsp
> www.xyz.com/aboutus.html -> www.xyz.com/aboutus.jsp
> www.xyz.com/mission/mission.html moved to www.xyz.com/mission.jsp
> etc.
>
> No, I do know anything about mod_proxy. I will look into it right away.
>
> Thanks,
> Shashi
>
>
>
>
>
>
>
> On Fri, Apr 11, 2008 at 3:28 PM, Francis Galiegue <fg...@gmail.com> wrote:
> > 2008/4/11, Shashidhar Rampally <sh...@gmail.com>:
> >
> > > Francis,
> > >
> > > I placed the following in httpd.conf. However, the next time I visited
> > > xyz.com, it took me to Tomcat home page.
> > > <VirtualHost xyz.com:80>
> > > DocumentRoot /not/a/valid/folder
> > > ServerName xyz.com
> > >
> > > RedirectMatch Permanent /(.*) http://www.xyz.com/$1
> > >
> > > </VirtualHost>
> > > <VirtualHost www.xyz.com:80>
> > > DocumentRoot /usr/lib/apache-tomcat/webapps/xyz/
> > > ServerName www.xyz.com
> > > </VirtualHost>
> > >
> > >
> > > Your's is not a comprehensive/clean solution. We also moved about 10
> > > links. So I also wish to permanently redirect these HTML pages too.
> > >
> > > So what would really help me is a URL rewriting module/plug-in like
> > > mod_rewrite.
> > >
> >
> > Please clarify. What are these "10 links"? Individual files or whole
> > directories/webapps?
> >
> > Also, have you considered mod_proxy (ProxyPass and ProxyPassReverse)?
> >
> > --
> >
> >
> > Francis Galiegue, fgaliegue@gmail.com
> > "When it comes to performance, weight is everything" - Tiff Needell
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 301 permanent redirects in Apache + Tomcat using mod_jk
Posted by Shashidhar Rampally <sh...@gmail.com>.
Francis,
Sorry if I offended you.
Those links are
www.xyz.com/specsheets.html -> www.xyz.com/specsheet.jsp
www.xyz.com/aboutus.html -> www.xyz.com/aboutus.jsp
www.xyz.com/mission/mission.html moved to www.xyz.com/mission.jsp
etc.
No, I do know anything about mod_proxy. I will look into it right away.
Thanks,
Shashi
On Fri, Apr 11, 2008 at 3:28 PM, Francis Galiegue <fg...@gmail.com> wrote:
> 2008/4/11, Shashidhar Rampally <sh...@gmail.com>:
>
> > Francis,
> >
> > I placed the following in httpd.conf. However, the next time I visited
> > xyz.com, it took me to Tomcat home page.
> > <VirtualHost xyz.com:80>
> > DocumentRoot /not/a/valid/folder
> > ServerName xyz.com
> >
> > RedirectMatch Permanent /(.*) http://www.xyz.com/$1
> >
> > </VirtualHost>
> > <VirtualHost www.xyz.com:80>
> > DocumentRoot /usr/lib/apache-tomcat/webapps/xyz/
> > ServerName www.xyz.com
> > </VirtualHost>
> >
> >
> > Your's is not a comprehensive/clean solution. We also moved about 10
> > links. So I also wish to permanently redirect these HTML pages too.
> >
> > So what would really help me is a URL rewriting module/plug-in like
> > mod_rewrite.
> >
>
> Please clarify. What are these "10 links"? Individual files or whole
> directories/webapps?
>
> Also, have you considered mod_proxy (ProxyPass and ProxyPassReverse)?
>
> --
>
>
> Francis Galiegue, fgaliegue@gmail.com
> "When it comes to performance, weight is everything" - Tiff Needell
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Kerberos based login for tomcat ( how?)
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Venkatesh Jayaraman (jvenky) [mailto:jvenky@cisco.com]
> Subject: Kerberos based login for tomcat ( how?)
>
> Any additional information is appreciated.
Tomcat doesn't have direct support for Kerberos, but you can use
Tomcat's JAASRealm with an appropriate LoginModule in conjunction with
various JRE packages:
http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#JAASRealm
Wendy S has some useful how-tos here:
http://wiki.wsmoak.net/cgi-bin/wiki.pl?TomcatKerberos
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Kerberos based login for tomcat ( how?)
Posted by "Venkatesh Jayaraman (jvenky)" <jv...@cisco.com>.
Added Subject ...;D
Any additional information is appreciated.
http://www.nabble.com/Kerberos-login-for-Tomcat-to9733594.html
-----Original Message-----
From: Venkatesh Jayaraman (jvenky)
Sent: Friday, April 11, 2008 2:52 PM
To: 'Tomcat Users List'
Subject:
Helo
How do we support Kerberos based login for tomcat. Do we have any
configuration to enable it?
Thanks
-Venky
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 301 permanent redirects in Apache + Tomcat using mod_jk
Posted by Francis Galiegue <fg...@gmail.com>.
2008/4/11, Shashidhar Rampally <sh...@gmail.com>:
> Francis,
>
> I placed the following in httpd.conf. However, the next time I visited
> xyz.com, it took me to Tomcat home page.
> <VirtualHost xyz.com:80>
> DocumentRoot /not/a/valid/folder
> ServerName xyz.com
>
> RedirectMatch Permanent /(.*) http://www.xyz.com/$1
>
> </VirtualHost>
> <VirtualHost www.xyz.com:80>
> DocumentRoot /usr/lib/apache-tomcat/webapps/xyz/
> ServerName www.xyz.com
> </VirtualHost>
>
>
> Your's is not a comprehensive/clean solution. We also moved about 10
> links. So I also wish to permanently redirect these HTML pages too.
>
> So what would really help me is a URL rewriting module/plug-in like
> mod_rewrite.
>
Please clarify. What are these "10 links"? Individual files or whole
directories/webapps?
Also, have you considered mod_proxy (ProxyPass and ProxyPassReverse)?
--
Francis Galiegue, fgaliegue@gmail.com
"When it comes to performance, weight is everything" - Tiff Needell
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 301 permanent redirects in Apache + Tomcat using mod_jk
Posted by Shashidhar Rampally <sh...@gmail.com>.
Francis,
I placed the following in httpd.conf. However, the next time I visited
xyz.com, it took me to Tomcat home page.
<VirtualHost xyz.com:80>
DocumentRoot /not/a/valid/folder
ServerName xyz.com
RedirectMatch Permanent /(.*) http://www.xyz.com/$1
</VirtualHost>
<VirtualHost www.xyz.com:80>
DocumentRoot /usr/lib/apache-tomcat/webapps/xyz/
ServerName www.xyz.com
</VirtualHost>
Your's is not a comprehensive/clean solution. We also moved about 10
links. So I also wish to permanently redirect these HTML pages too.
So what would really help me is a URL rewriting module/plug-in like mod_rewrite.
Thanks,
Shashi
On Fri, Apr 11, 2008 at 1:45 PM, Francis Galiegue <fg...@gmail.com> wrote:
> 2008/4/11, Shashidhar Rampally <sh...@gmail.com>:
>
> > Thanks for the quick reply, Francis!
> >
> > My httpd.conf file doesn't have a single VirtualHost defined because I
> > am using mod_jk to forward all the requests to Tomcat.
>
> Well, I use mod_jk AND vitural hosts. Even though, in most cases, the
> hostname of the server is its real FQDN!
>
> mod_jk and VitrtualHosts are NOT incompatible. Meh, I even have my
> <Host> defined as only responding to localhost!
>
> --
>
>
> Francis Galiegue, fgaliegue@gmail.com
> "When it comes to performance, weight is everything" - Tiff Needell
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 301 permanent redirects in Apache + Tomcat using mod_jk
Posted by Francis Galiegue <fg...@gmail.com>.
2008/4/11, Shashidhar Rampally <sh...@gmail.com>:
> Thanks for the quick reply, Francis!
>
> My httpd.conf file doesn't have a single VirtualHost defined because I
> am using mod_jk to forward all the requests to Tomcat.
Well, I use mod_jk AND vitural hosts. Even though, in most cases, the
hostname of the server is its real FQDN!
mod_jk and VitrtualHosts are NOT incompatible. Meh, I even have my
<Host> defined as only responding to localhost!
--
Francis Galiegue, fgaliegue@gmail.com
"When it comes to performance, weight is everything" - Tiff Needell
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 301 permanent redirects in Apache + Tomcat using mod_jk
Posted by Shashidhar Rampally <sh...@gmail.com>.
Thanks for the quick reply, Francis!
My httpd.conf file doesn't have a single VirtualHost defined because I
am using mod_jk to forward all the requests to Tomcat. Otherwise I
understand how your solution would have worked. :)
I have alternate solution that involves changing Tomcat's server.xml
(which I've outlined below). However, its not as clean as using
mod_rewrite.
Thanks,
Shashi
Change tomcat/conf/server.xml as follows....
<Host name="xyz.com" appBase="webapps" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="xyzredirect">
</Context>
</Host>
<Host name="www.xyz.com" appBase="webapps" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="wwwxyz">
</Context>
</Host>
Put following code in webapps/xyzredirect/index.jsp
<%
//send HTTP 301 status code to browser
response.setStatus(response.SC_MOVED_PERMANENTLY);
//send user to new location
response.setHeader("Location", "http://www.xyz.com");
%>
On Fri, Apr 11, 2008 at 12:48 PM, Francis Galiegue <fg...@gmail.com> wrote:
> 2008/4/11, Shashidhar Rampally <sh...@gmail.com>:
>
> > Hi guys,
> >
> > I am trying to permanently redirect http://xyz.com to
> > http://www.xyz.com, which is hosted on Apache2 + Tomcat 5.5.9 with
> > mod_jk. I am trying to use .htaccess file to do so. So far my efforts
> > have been unsuccessful!
> >
>
> If I were you, I'd do a simple vhost for xyz.com:
>
> <Virtualhost xyz.com:80>
> ServerName xyz.com
> DocumentRoot /whatever/except/your/webapproot
> RedirectMatch Permanent /(.*) http://www.xyz.com/$1
> </Virtualhost>
>
> And then define the Virtualhost for www.xyz.com, pointing to the real
> webapp root, you see what I mean.
>
> I've been playing that trick before, and it worked. I think I'm
> missing something though.
>
>
> --
> Francis Galiegue, fgaliegue@gmail.com
> "When it comes to performance, weight is everything" - Tiff Needell
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 301 permanent redirects in Apache + Tomcat using mod_jk
Posted by Francis Galiegue <fg...@gmail.com>.
2008/4/11, Shashidhar Rampally <sh...@gmail.com>:
> Hi guys,
>
> I am trying to permanently redirect http://xyz.com to
> http://www.xyz.com, which is hosted on Apache2 + Tomcat 5.5.9 with
> mod_jk. I am trying to use .htaccess file to do so. So far my efforts
> have been unsuccessful!
>
If I were you, I'd do a simple vhost for xyz.com:
<Virtualhost xyz.com:80>
ServerName xyz.com
DocumentRoot /whatever/except/your/webapproot
RedirectMatch Permanent /(.*) http://www.xyz.com/$1
</Virtualhost>
And then define the Virtualhost for www.xyz.com, pointing to the real
webapp root, you see what I mean.
I've been playing that trick before, and it worked. I think I'm
missing something though.
--
Francis Galiegue, fgaliegue@gmail.com
"When it comes to performance, weight is everything" - Tiff Needell
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org