> -----Original Message----- > From: jieryn [mailto:jie...@gmail.com] > Sent: Friday, July 19, 2013 11:37 PM > To: Tomcat Users List > Subject: Apache Tomcat 7.x: Host+Alias and HTTP 301 > > Greetings, > > I'm using Apache Tomcat 7.0.42, with IBM Java 1.7.0-SR2, on SuSE SLED > 11 Linux. I have multiple host names which resolve to the same > application context, e.g. app.host1.com (host) and app.host2.com > (alias). I have implemented this within conf/server.xml via Host and > Alias definitions. > > Moving forward, I would like Apache Tomcat to send a permanent > redirect, HTTP 301, for any incoming request on app.host2.com to > app.host1.com. How can I achieve this? I no longer want both > app.host1.com and app.host2.com to work "invisibly" to the user; I want > the user to see the host1.com address in his/her browser and to teach > the user, perhaps very subtly, to use that host1.com hostname. > > I have tried Tuckey's URLRewrite filter, with a condition on > type="hostname", but I can not seem to get it right--lots of strange > infinite loop redirection for SSO. Regardless, this seems like > something that Apache Tomcat should be able to handle pretty easily.. > > Any help is appreciated, thanks, > -Jesse >
Jesse - Sounds like something I do all the time. First, you want to set up app.host2.com as a separate host. That might be all you need to do to make Tuckey's filter easier to configure. For this type of redirect though, I use HttpRedirectFilter from zlatkovic.com (http://www.zlatkovic.com/httpredirectfilter.en.html) as I found it much easier to configure than the Tuckey software. As long as you understand basic regular expressions, you should have no problems with it. Jeff --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org