I've wondered about this as well, and perhaps this is what you need:? http://httpd.apache.org/docs/mod/core.html#usecanonicalname
I have a production app that depends on the behaviour you want changed (my tomcat app depends on ServerName being passed for all requests through ServerAlias), but it seemed to me there must be a way to switch this in Apache. > -----Original Message----- > From: Kurt [mailto:[EMAIL PROTECTED] > Sent: Friday, April 23, 2004 11:01 AM > To: [EMAIL PROTECTED] > Subject: Apache not sending the requested URL to Tomcat... > > > In Apache I have VHosting setup so that multiple domains all > share the same pub directory. In Tomcat I have VHosting setup > so that multiple domains all share a single web application INSTANCE > > When I have Apache pass requests to Tomcat, only the domain > specified in the "ServerName" attribute of the Apache VHost > config gets passed to Tomcat, even though I'm accessing the > site under one of the domains specified in a "ServerAlias" attribute. > > i.e. I type in www.otherdomain.com/showServerName.jsp in my > browser and the value displayed is www.domain.com NOT > www.otherdomain.com How do I get it to display > www.otherdomain.com? I need to be able to tell which domain > the user has typed into their browser. I have tried > request.getRequestURL and this also returns www.domain.com..... > > I am grateful for any assistance. > > > Example Config...... > > In Apache..... > > <VirtualHost 127.0.0.2> > ServerName www.domain.com > ServerAlias www.otherdomain.com > ...... > </VirtualHost> > > In Tomcat > > <Host name="www.domain.com" debug="0" appBase="/webs/MyWebApp" > unpackWARs="true" autoDeploy="true" > > > <Alias>www.otherdomain.com</Alias> > <Alias>www.anotherdomain.com</Alias> > ....... > </Host> > > > My Environment > ---------------------------- > Apache 2 > Tomcat 4.1.24 > RH Linux 7.x > > > > I have tried setting up multiple VHost entries in Apache, but > then I received an error that Tomcat couldn't find the > mapping to xxxx.do (I'm using Struts, but it didn't work for > JSPs either) for all domains EXCEPT the domain in the "name" > attribute of the "Host" tag in the Tomcat config file. It did > serve static files from within the pub directory just fine. > Maybe I wasn't doing things right when I tried this, but I > hope somebody can provide me with the right way to do this, > or an alternative that works. > > i.e. > > In Apache > > <VirtualHost 127.0.0.2> > ServerName www.domain.com > ...... > </VirtualHost> > > <VirtualHost 127.0.0.2> > ServerName www.otherdomain.com > ...... > </VirtualHost> > > > Again, I am grateful for any assistance. > > Kurt Bonnet > [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
