tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Serve same content to multiple URL's
Date Thu, 04 Apr 2013 18:41:27 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Chris,

On 4/4/13 12:28 PM, Chris Arnold wrote:
> I am not sure if this is a Tomcat issue or an apache issue, so i
> will ask on both lists.

While the solution might be in httpd, the Tomcat-user list is the
right place to ask about this kind of thing.

> We have tomcat 6.03 on SLES11 and have content/webapp that we want 
> to server to multiple domains. We have 1 domain working using 
> http://share.domain1.com. What we want is access to this same
> webapp using http://share.anydomain.com.

Generally speaking, you can let Tomcat (or even httpd) serve any
number of domain names identically by simply not using any
configuration that would lead to those virtual hosts being treated
differently.

> Here are configuration files:
> 
> worker.properties:
> 
> worker.list=jk-status worker.jk-status.type=status 
> worker.jk-status.read_only=true worker.list=jk-manager 
> worker.list=worker1 worker.list=worker2 
> worker.jk-manager.type=status worker.list=balancer 
> worker.balancer.type=lb worker.balancer.max_reply_timeouts=10 
> worker.balancer.balance_workers=worker1 
> worker.worker1.reference=worker.template 
> worker.worker1.host=localhost worker.worker1.port=8009 
> worker.worker1.activation=A 
> worker.balancer.balance_workers=worker2 
> worker.worker2.reference=worker.template 
> worker.worker2.host=localhost worker.worker2.port=8009 
> worker.worker2.activation=A worker.template.type=ajp13 
> worker.template.socket_keepalive=true 
> worker.template.connection_pool_minsize=0 
> worker.template.connection_pool_timeout=600 
> worker.template.reply_timeout=300000 
> worker.template.recovery_options=3

Read-up on worker templates.

> Here is the configured virtualhost for that is working: JkMount
> /share|/* worker1 RedirectMatch ^/$ http://share.domain.com/share/
> 
> I have tried to add a second worker (worker2) in workers.properties
> and added a virtualhost like: Here is the configured virtualhost
> for domain2: 2nd virtualhost: JkMount /share|/* worker2 
> RedirectMatch ^/$ http://share.domain2.com/share/

If you want the content to be identical, why do you need a second worker?

Why do you need a second VirtualHost, even?

> When i type http://share.domain2.com i arrive at 1 of our websites
>  but not the tomcat content. When i type 
> http://share.domain2.com/share i get a 404 error. Do i need to
> define another worker to accomplish this or should the defined
> worker work for any domain given there is a virtualhost defined?

Workers don't care about VirtualHosts: the client's request headers
will be sent to Tomcat and another round of virtual host resolution
will occur over there. Having separate workers does not help anything.

I'm not sure why you are getting 404s: any idea if it's a response
coming from httpd or Tomcat? If you browse to
http://share.domain2.com/ are you properly redirected (as I would
expect given the above configuration) to http://share.domain2.com/share ?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRXclXAAoJEBzwKT+lPKRY1mYQAJz/KFXbtNaMYcpDymn94Krg
ENxqVUa/GwyPZf634M8o83E/kzqxE/g5hAxUnAi28YAnM4P3FQ0CsL09vZEJ4rpB
I33K8NLakR6HdGP+mt2otij9b6CVI62NvXI+TDWduoDDmvyHIoaYCW+36XcxPoVe
89H3LHDVE6BJ6NYh4nrmrJIzyfLNr6V0Z2A0gs39YOnknjAkxj1SdlZErNMqSvP9
V+HSGCawFU4h+dMXUzmffUWmdkWcImwMUx71za2ny2+9KeVdZreycXCJtN8m1LAE
WcBM4HTogQ29ZN/RRWtuOrkMKO2XF/5xc2GdrueQNatah6WzB6V0oN4OFy5/1dwi
G3ly45Mw2jdcqapoSUOrq61/7dEmnE4jDNWBQVAY2KnshjlHMdMWJD/VHxL9ROIQ
K/KlgPmgDFwzT3RRXENMt1cI4DEkjVDkiskwRNy4XWLX048TATSzZJftCvWXeBNJ
YgvsBCfXvpGJLWO+SVJcltprQGYy1FK4CnWiGEAy7Z2pseYZg4yTwmawpnxsOJsZ
bOQLLNJ/WCEh237/g0mH7Tp0ms2RlUa6Xe5Nd8Fa/zDKxYVUWODQY39P/lF8erD5
Prsd/pS1/+l7DIsPhaZO7DG9qfObGmsLWrBKulDtLewUJfza4X9OApJ3FIlKoL0v
3desveiO0MxcZ9ILBFSw
=4jO8
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message