Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-26 Thread arnaud icard

Ok I will remove apache httpd and use Tomcat's virtual hosts system.

thank you all for your response.


Caldarale, Charles R a écrit le 25/08/2010 18:31:

From: Wesley Acheson [mailto:wesley.ache...@gmail.com]
Subject: Re: How to configure different default webapp in function of requested 
hostname on one tomcat server
 
   

You can configure the host element as per
http://tomcat.apache.org/tomcat-6.0-doc/config/host.html
 

Also look at:
http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts

(Don't be scared off by the use of the word development in the above.)

  - 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 unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

   



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

Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-26 Thread Felix Schumacher
Hello, 

even if you decided to remove httpd and go directly with virtual hosts in
tomcat, there are two things in your httpd config, which could be advanced
(see inline below).

On Wed, 25 Aug 2010 18:13:28 +0200, arnaud icard
arnaud.ic...@univ-avignon.fr wrote:
 Hello,
 
  I guess my subject isn't clear at all so here is my problem :
 
  I have 1 server with Apache2/Tomcat6 installed.
  The purpose of this server is to host multiple webapps (this one for
 instance : http://www.jasig.org/cas [1])
  For each of these webapps, we will contact the server with different
 urls :
 
   * cas.domain.fr for the CAS webapp
 
   * ent.domain.fr for the ENT webapp
   * appli1.domain.fr for the appli1 webapp
 
  How can I do such a thing ?
 
  Until now, I have created a virtual host in Apache with this
 configuration :
 
  JkMount /* default
I think you want /|* which matches / as well as /ANYTHING_ELSE. So tomcat
gets a chance to display its own default page.

 
  ServerName appli1.domain.fr
  ServerAdmin webmas...@domain.fr [2]
 
  DocumentRoot /opt/tomcat/webapps/appli1
If that directory is the normal webapp directory, you are risking to
expose WEB-INF and META-INF to the outside world. That could be a serious
security issue. Your JkMount directive above should make this risk a
non-issue for the moment, but you may change that in future and forget
about the implications.

Bye
 Felix
 
  ErrorLog /var/www/appli1.domain.fr/logs/error.log
  CustomLog /var/www/appli1.domain.fr/logs/access.log common
 
  Options -Indexes
 
  However,when accessing to http://appli1.domain.fr [3], I am always
 redirected to the ROOT pages and not the appli1.
 
  I hope to be as clear as possible!
 
  Would you have some simple and elegant solution?
 
  Best regards,
  arnaud

 
 Links:
 --
 [1] http://www.jasig.org/cas
 [2] mailto:webmas...@domain.fr
 [3] http://appli1.domain.fr

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



Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-26 Thread arnaud icard

httpd is stopped.

Here is what I have done in the /opt/tomcat/conf/server.xml :

   /Engine name=Catalina defaultHost=tomcat00c
   ...
   Host name=tomcat00c  appBase=webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false

   Valve className=org.apache.catalina.valves.AccessLogValve
   directory=/var/log/tomcat/hosts/
   prefix=tomcat00c_access_log. suffix=.log
   pattern=common resolveHosts=false/
   /Host

   Host name=cas  appBase=/home/tomcat/hosts/cas/webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false

   Valve className=org.apache.catalina.valves.AccessLogValve
   directory=/var/log/tomcat/hosts/
   prefix=cas_access_log. suffix=.log
   pattern=common resolveHosts=false/
   /Host

   Host name=appli1  appBase=/home/tomcat/hosts///appli1///webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false

   Valve className=org.apache.catalina.valves.AccessLogValve
   directory=/var/log/tomcat/hosts/
   prefix=//appli1//_access_log. suffix=.log
   pattern=common resolveHosts=false/
   /Host
   /Engine/

When connecting to appli1.test.fr, I am redirected to the default ROOT 
content (which means to the tomcat00c host).


I am a little lost now in this tomcat jungle. No black smoke so far 
hopefully :)


arnaud icard a écrit le 26/08/2010 09:21:

Ok I will remove apache httpd and use Tomcat's virtual hosts system.

thank you all for your response.


Caldarale, Charles R a écrit le 25/08/2010 18:31:

From: Wesley Acheson [mailto:wesley.ache...@gmail.com]
Subject: Re: How to configure different default webapp in function 
of requested hostname on one tomcat server

You can configure the host element as per
http://tomcat.apache.org/tomcat-6.0-doc/config/host.html

Also look at:
http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts

(Don't be scared off by the use of the word development in the above.)

  - 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 unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org





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

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

Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-26 Thread Pid
On 26/08/2010 11:39, arnaud icard wrote:
 httpd is stopped.
 
 Here is what I have done in the /opt/tomcat/conf/server.xml :
 
 /Engine name=Catalina defaultHost=tomcat00c
 ...
 Host name=tomcat00c  appBase=webapps
 unpackWARs=true autoDeploy=true
 xmlValidation=false xmlNamespaceAware=false

If the DNS records you're using are anything other than the 'name'
attribute, you'll need an Alias, to match:

 Aliaswww.example.com/Alias


p


  Valve
 className=org.apache.catalina.valves.AccessLogValve
 directory=/var/log/tomcat/hosts/ 
prefix=tomcat00c_access_log. suffix=.log
 pattern=common resolveHosts=false/
   /Host
 
   Host name=cas  appBase=/home/tomcat/hosts/cas/webapps
 unpackWARs=true autoDeploy=true
 xmlValidation=false xmlNamespaceAware=false
 
  Valve
 className=org.apache.catalina.valves.AccessLogValve
 directory=/var/log/tomcat/hosts/ 
prefix=cas_access_log. suffix=.log
 pattern=common resolveHosts=false/
   /Host
 
   Host name=appli1 
 appBase=/home/tomcat/hosts///appli1///webapps
 unpackWARs=true autoDeploy=true
 xmlValidation=false xmlNamespaceAware=false
 
 Valve className=org.apache.catalina.valves.AccessLogValve
 directory=/var/log/tomcat/hosts/ 
prefix=//appli1//_access_log. suffix=.log
 pattern=common resolveHosts=false/
   /Host
 /Engine/
 
 When connecting to appli1.test.fr, I am redirected to the default ROOT
 content (which means to the tomcat00c host).
 
 I am a little lost now in this tomcat jungle. No black smoke so far
 hopefully :)
 
 arnaud icard a écrit le 26/08/2010 09:21:
 Ok I will remove apache httpd and use Tomcat's virtual hosts system.

 thank you all for your response.


 Caldarale, Charles R a écrit le 25/08/2010 18:31:
 From: Wesley Acheson [mailto:wesley.ache...@gmail.com]
 Subject: Re: How to configure different default webapp in function
 of requested hostname on one tomcat server
  
   
 You can configure the host element as per
 http://tomcat.apache.org/tomcat-6.0-doc/config/host.html
  
 Also look at:
 http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts

 (Don't be scared off by the use of the word development in the above.)

   - 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 unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org





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



0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-26 Thread arnaud icard
Right the parameter name in host and the parameter defaultHost in 
engine need the server's FQDN.

I didn't realize that !

Thanks a lot Pid.

Have a great day.

Best regards,
arnaud


Pid a écrit le 26/08/2010 13:54:

On 26/08/2010 11:39, arnaud icard wrote:
   

httpd is stopped.

Here is what I have done in the /opt/tomcat/conf/server.xml :

 /Engine name=Catalina defaultHost=tomcat00c
 ...
 Host name=tomcat00c  appBase=webapps
 unpackWARs=true autoDeploy=true
 xmlValidation=false xmlNamespaceAware=false
 

If the DNS records you're using are anything other than the 'name'
attribute, you'll need an Alias, to match:

  Aliaswww.example.com/Alias


p


   

  Valve
 className=org.apache.catalina.valves.AccessLogValve
 directory=/var/log/tomcat/hosts/
prefix=tomcat00c_access_log. suffix=.log
 pattern=common resolveHosts=false/
   /Host

   Host name=cas  appBase=/home/tomcat/hosts/cas/webapps
 unpackWARs=true autoDeploy=true
 xmlValidation=false xmlNamespaceAware=false

  Valve
 className=org.apache.catalina.valves.AccessLogValve
 directory=/var/log/tomcat/hosts/
prefix=cas_access_log. suffix=.log
 pattern=common resolveHosts=false/
   /Host

   Host name=appli1
 appBase=/home/tomcat/hosts///appli1///webapps
 unpackWARs=true autoDeploy=true
 xmlValidation=false xmlNamespaceAware=false

 Valve className=org.apache.catalina.valves.AccessLogValve
 directory=/var/log/tomcat/hosts/
prefix=//appli1//_access_log. suffix=.log
 pattern=common resolveHosts=false/
   /Host
 /Engine/

When connecting to appli1.test.fr, I am redirected to the default ROOT
content (which means to the tomcat00c host).

I am a little lost now in this tomcat jungle. No black smoke so far
hopefully :)

arnaud icard a écrit le 26/08/2010 09:21:
 

Ok I will remove apache httpd and use Tomcat's virtual hosts system.

thank you all for your response.


Caldarale, Charles R a écrit le 25/08/2010 18:31:
   

From: Wesley Acheson [mailto:wesley.ache...@gmail.com]
Subject: Re: How to configure different default webapp in function
of requested hostname on one tomcat server

   


 

You can configure the host element as per
http://tomcat.apache.org/tomcat-6.0-doc/config/host.html

   

Also look at:
http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts

(Don't be scared off by the use of the word development in the above.)

   - 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 unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


 



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



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



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

Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-26 Thread André Warnier



arnaud icard wrote:

httpd is stopped.

Here is what I have done in the /opt/tomcat/conf/server.xml :

   /Engine name=Catalina defaultHost=tomcat00c
   ...
   Host name=tomcat00c  appBase=webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false

   Valve className=org.apache.catalina.valves.AccessLogValve
   directory=/var/log/tomcat/hosts/
   prefix=tomcat00c_access_log. suffix=.log
   pattern=common resolveHosts=false/
   /Host

   Host name=cas  appBase=/home/tomcat/hosts/cas/webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false

   Valve className=org.apache.catalina.valves.AccessLogValve
   directory=/var/log/tomcat/hosts/
   prefix=cas_access_log. suffix=.log
   pattern=common resolveHosts=false/
   /Host

   Host name=appli1  appBase=/home/tomcat/hosts///appli1///webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false

   Valve className=org.apache.catalina.valves.AccessLogValve
   directory=/var/log/tomcat/hosts/
   prefix=//appli1//_access_log. suffix=.log
   pattern=common resolveHosts=false/
   /Host
   /Engine/

When connecting to appli1.test.fr, I am redirected to the default ROOT 
content (which means to the tomcat00c host).


I am a little lost now in this tomcat jungle. No black smoke so far 
hopefully :)




It is very simple, really :

1) The defaultHost (as named in the Engine tag) is the one which will serve the request 
(any request), when Tomcat is unable to match the request's hostname *exactly* with one of 
the Host tags' name attribute.
In your case, you have a Host with name=appli1, but the request says appli1.test.fr. 
That does not match (appli1 != appl1.test.fr). So Tomcat defaults to the defaultHost 
tomcat00c.


(Under Apache httpd, the default VirtualHost is the first one named, from top 
to bottom.
In Tomcat, the order does not matter, since you explicitly say which one is the 
defaultHost, in the Engine tag.)


2) something similar would happen with the application's name :
A request for http://appli1.test.fr/appli1; would normally be mapped to the Context 
/appli1 in the Host named appli11.test.fr.  But instead (see (1)), it gets mapped to 
the defaultHost.  And this defaultHost does not have an application named appli1, so the 
request gets mapped to the default application (ROOT) in the defaultHost (tomcat00c), 
inside which Tomcat will be looking for a subdirectory 
(catalina_base)/webapps/ROOT/appli1, and probably not find it.


3) you have far too many repeated // in your Host appli1.  I am quite sure that the 
prefix for the access log will not work as shown.




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



Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-26 Thread arnaud icard



André Warnier a écrit le 26/08/2010 14:14:



arnaud icard wrote:

httpd is stopped.

Here is what I have done in the /opt/tomcat/conf/server.xml :

   /Engine name=Catalina defaultHost=tomcat00c
   ...
Host name=tomcat00c  appBase=webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false

Valve className=org.apache.catalina.valves.AccessLogValve
   directory=/var/log/tomcat/hosts/
   prefix=tomcat00c_access_log. suffix=.log
   pattern=common resolveHosts=false/
/Host

Host name=cas  appBase=/home/tomcat/hosts/cas/webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false

Valve className=org.apache.catalina.valves.AccessLogValve
   directory=/var/log/tomcat/hosts/
   prefix=cas_access_log. suffix=.log
   pattern=common resolveHosts=false/
/Host

Host name=appli1  appBase=/home/tomcat/hosts///appli1///webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false

Valve className=org.apache.catalina.valves.AccessLogValve
   directory=/var/log/tomcat/hosts/
   prefix=//appli1//_access_log. suffix=.log
   pattern=common resolveHosts=false/
/Host
/Engine/

When connecting to appli1.test.fr, I am redirected to the default 
ROOT content (which means to the tomcat00c host).


I am a little lost now in this tomcat jungle. No black smoke so far 
hopefully :)




It is very simple, really :

1) The defaultHost (as named in the Engine tag) is the one which will 
serve the request (any request), when Tomcat is unable to match the 
request's hostname *exactly* with one of the Host tags' name attribute.
In your case, you have a Host with name=appli1, but the request says 
appli1.test.fr. That does not match (appli1 != appl1.test.fr). 
So Tomcat defaults to the defaultHost tomcat00c.


(Under Apache httpd, the default VirtualHost is the first one named, 
from top to bottom.
In Tomcat, the order does not matter, since you explicitly say which 
one is the defaultHost, in the Engine tag.)


2) something similar would happen with the application's name :
A request for http://appli1.test.fr/appli1; would normally be mapped 
to the Context /appli1 in the Host named appli11.test.fr.  But 
instead (see (1)), it gets mapped to the defaultHost.  And this 
defaultHost does not have an application named appli1, so the 
request gets mapped to the default application (ROOT) in the 
defaultHost (tomcat00c), inside which Tomcat will be looking for a 
subdirectory (catalina_base)/webapps/ROOT/appli1, and probably not 
find it.




Yes this is where I made a mistake.
The parameters name and defaultHost must be the FULL name (i.e. 
hostname.domain)


3) you have far too many repeated // in your Host appli1.  I am 
quite sure that the prefix for the access log will not work as shown.




These // does not come from my server.xml
Copy/Paste or mail server problem.

Thus no big deal but thanks for the comment.




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




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

Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-26 Thread André Warnier

arnaud icard wrote:
...


Yes this is where I made a mistake.
The parameters name and defaultHost must be the FULL name (i.e. 
hostname.domain)



No. I mean no, it is not exactly that.

For the defaultHost, it does not matter very much, because it is the default and anything 
that does not match exactly will end up there anyway.


But for the others, as far as I know, the point is that the Host name attribute *must 
match the Host: header in the HTTP request, exactly*.
If requests can come in with a Host: header being just appli1, then you need to have, in 
the corresponding Host tag,

- either the name attribute = appli1
- or an Aliasappli1/Alias tag inside the Host section.

For example:

 Host name=appli1.test.fr
   Aliasappli1/Alias
   ...
 /Host


Unless Tomcat itself does a double reverse DNS lookup to make appli1 equivalent to 
appli1.test.fr, but this would surprise me.




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



Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-26 Thread arnaud icard

I think I understand what you're explaining.

I keep that in mind if I encounter in the future some strange behaviours 
from the non-default applications.


Thanks,
arnaud.

André Warnier a écrit le 26/08/2010 14:40:

arnaud icard wrote:
...


Yes this is where I made a mistake.
The parameters name and defaultHost must be the FULL name (i.e. 
hostname.domain)



No. I mean no, it is not exactly that.

For the defaultHost, it does not matter very much, because it is the 
default and anything that does not match exactly will end up there 
anyway.


But for the others, as far as I know, the point is that the Host name 
attribute *must match the Host: header in the HTTP request, exactly*.
If requests can come in with a Host: header being just appli1, then 
you need to have, in the corresponding Host tag,

- either the name attribute = appli1
- or an Aliasappli1/Alias tag inside the Host section.

For example:

Host name=appli1.test.fr
Aliasappli1/Alias
   ...
/Host


Unless Tomcat itself does a double reverse DNS lookup to make appli1 
equivalent to appli1.test.fr, but this would surprise me.




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




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

Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-26 Thread Pid
On 26/08/2010 13:40, André Warnier wrote:
 arnaud icard wrote:
 ...

 Yes this is where I made a mistake.
 The parameters name and defaultHost must be the FULL name (i.e.
 hostname.domain)

 No. I mean no, it is not exactly that.
 
 For the defaultHost, it does not matter very much, because it is the
 default and anything that does not match exactly will end up there anyway.
 
 But for the others, as far as I know, the point is that the Host name
 attribute *must match the Host: header in the HTTP request, exactly*.
 If requests can come in with a Host: header being just appli1, then
 you need to have, in the corresponding Host tag,
 - either the name attribute = appli1
 - or an Aliasappli1/Alias tag inside the Host section.
 
 For example:
 
  Host name=appli1.test.fr
Aliasappli1/Alias
...
  /Host

This reverse must be valid:

  Host name=appli1
Aliasappli1.test.fr/Alias
...
  /Host

or the following would not work:

  Host name=appli1.test.fr
Aliasappli1.test.de/Alias
...
  /Host


p


 
 
 Unless Tomcat itself does a double reverse DNS lookup to make appli1
 equivalent to appli1.test.fr, but this would surprise me.
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 



0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-26 Thread André Warnier

Pid wrote:

On 26/08/2010 13:40, André Warnier wrote:

arnaud icard wrote:
...

Yes this is where I made a mistake.
The parameters name and defaultHost must be the FULL name (i.e.
hostname.domain)


No. I mean no, it is not exactly that.

For the defaultHost, it does not matter very much, because it is the
default and anything that does not match exactly will end up there anyway.

But for the others, as far as I know, the point is that the Host name
attribute *must match the Host: header in the HTTP request, exactly*.
If requests can come in with a Host: header being just appli1, then
you need to have, in the corresponding Host tag,
- either the name attribute = appli1
- or an Aliasappli1/Alias tag inside the Host section.

For example:

 Host name=appli1.test.fr
   Aliasappli1/Alias
   ...
 /Host


This reverse must be valid:

  Host name=appli1
Aliasappli1.test.fr/Alias
...
  /Host

or the following would not work:

  Host name=appli1.test.fr
Aliasappli1.test.de/Alias
...
  /Host



Pid, I don't get what you mean above.

Example :

To put DNS aside for a moment, suppose I have this in my local hosts file (which is 
consulted by the local resolver before DNS gets involved) :


212.85.38.176 mira  mira.wissensbank.com

(and, at this IP address, is a host with a Tomcat server listening on port 80)

So, as far as my local workstation is concerned, both mira and mira.wissensbank.com 
are aliases of eachother, in the sense that they both resolve to the same IP address.


A) Then, I start a browser and request :
http://mira/

- the browser calls the local resolver to resolve mira into an IP address
- the local resolver looks up mira in the local hosts file, finds it, and returns the IP 
address 212.85.38.176

- the browser now establishes a TCP connection with IP address 212.85.38.176
- when the TCP connection is obtained, the browser sends the following request over that 
TCP connection :


GET / HTTP/1.1
Host: mira
...

- the Tomcat at this IP address gets the Host: header's value (mira), and looks up to 
find a Host in its configuration, which has either

- the Host attribute name=mira
- or an Aliasmira/Alias

If it does not find such, the request is passed to the default Host

B) If instead, the request which I type in the browser's URL bar is
http://mira.wissensbank.com
then

- the browser calls the local resolver to resolve mira.wissensbank.com into 
an IP address
- the local resolver looks up mira.wissensbank.com in the local hosts file, finds it, 
and returns the IP address 212.85.38.176

- the browser now establishes a TCP connection with IP address 212.85.38.176
- when the TCP connection is obtained, the browser sends the following request over that 
TCP connection :

GET / HTTP/1.1
Host: mira.wissensbank.com
...

- the Tomcat at this IP address gets the Host: header's value (mira.wissensbank.com), 
and looks up to find a Host in its configuration, which has either

- the Host attribute name=mira.wissensbank.com
- or an Aliasmira.wissensbank.com/Alias

and if it does not find such, the request will be passed to the defaultHost.

All the above remains true even if there is nothing in the local hosts file, and the above 
translations to IP address are made via a DNS lookup.



So, let's say that this Tomcat only has the following (non-default) Host tag :
Host name=mira.wissensbank.com
/Host

then any request addressed by my browser to
http://mira

will end up being served by the defaultHost.


As long as the browser /can/ resolve the hostname into an IP address, it will always make 
the connection to that IP address and send the request over it.
But the content of the Host: header will be the hostname as indicated in the request 
URL, as is, and not necessarily translated to its canonical form.


Whether Tomcat itself would attempt to do some kind of DNS lookup for a partial name, in 
order to canonicise it, is besides the point really, because even if it would - which 
would surprise me - there is no certainty that it would be able to translate mira into 
mira.wissensbank.com.


It is very frequent in intranets to have a mixture of links floating around, some 
referring only to the hostname, some with the full FQDN.  If you want Tomcat to respond 
properly to both kinds of links, you must have both names referenced inside the Host 
section, whether as the host name, or as an Alias.
It does not matter which one of them you use for the Host attribute or the Alias, but they 
must both be there, or some requests will end up with the defaultHost.



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



Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-26 Thread Pid
On 26/08/2010 14:52, André Warnier wrote:
 Pid wrote:
 On 26/08/2010 13:40, André Warnier wrote:
 arnaud icard wrote:
 ...
 Yes this is where I made a mistake.
 The parameters name and defaultHost must be the FULL name (i.e.
 hostname.domain)

 No. I mean no, it is not exactly that.

 For the defaultHost, it does not matter very much, because it is the
 default and anything that does not match exactly will end up there
 anyway.

 But for the others, as far as I know, the point is that the Host name
 attribute *must match the Host: header in the HTTP request, exactly*.
 If requests can come in with a Host: header being just appli1, then
 you need to have, in the corresponding Host tag,
 - either the name attribute = appli1
 - or an Aliasappli1/Alias tag inside the Host section.

 For example:

  Host name=appli1.test.fr
Aliasappli1/Alias
...
  /Host

 This reverse must be valid:

   Host name=appli1
 Aliasappli1.test.fr/Alias
 ...
   /Host

 or the following would not work:

   Host name=appli1.test.fr
 Aliasappli1.test.de/Alias
 ...
   /Host

 
 Pid, I don't get what you mean above.

I misread what you were saying.  I thought you were saying that the
host.name attribute must match the relevant headers.host value, rather
than an Alias.


p


0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-25 Thread arnaud icard

Hello,

I guess my subject isn't clear at all so here is my problem :

I have 1 server with Apache2/Tomcat6 installed.
The purpose of this server is to host multiple webapps (this one for 
instance : http://www.jasig.org/cas)

For each of these webapps, we will contact the server with different urls :

   * cas.domain.fr for the CAS webapp
   * ent.domain.fr for the ENT webapp
   * appli1.domain.fr for the appli1 webapp

How can I do such a thing ?

Until now, I have created a virtual host in Apache with this configuration :

   VirtualHost *:80
JkMount /* default

ServerName appli1.domain.fr
ServerAdmin webmas...@domain.fr

DocumentRoot /opt/tomcat/webapps/appli1

ErrorLog /var/www/appli1.domain.fr/logs/error.log
CustomLog /var/www/appli1.domain.fr/logs/access.log common

   directory /opt/tomcat/webapps/appli1
Options -Indexes
   /directory
   /VirtualHost


However,when accessing to http://appli1.domain.fr, I am always 
redirected to the ROOT pages and not the appli1.


I hope to be as clear as possible!

Would you have some simple and elegant solution?

Best regards,
arnaud

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

Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-25 Thread Wesley Acheson
Hi,

You can configure the host element as per
http://tomcat.apache.org/tomcat-6.0-doc/config/host.html


On Wed, Aug 25, 2010 at 6:13 PM, arnaud icard
arnaud.ic...@univ-avignon.fr wrote:
 Hello,

 I guess my subject isn't clear at all so here is my problem :

 I have 1 server with Apache2/Tomcat6 installed.
 The purpose of this server is to host multiple webapps (this one for
 instance : http://www.jasig.org/cas)
 For each of these webapps, we will contact the server with different urls :

 cas.domain.fr for the CAS webapp
 ent.domain.fr for the ENT webapp
 appli1.domain.fr for the appli1 webapp

 How can I do such a thing ?

 Until now, I have created a virtual host in Apache with this configuration :

 VirtualHost *:80
     JkMount /* default

     ServerName appli1.domain.fr
     ServerAdmin webmas...@domain.fr

     DocumentRoot /opt/tomcat/webapps/appli1

     ErrorLog /var/www/appli1.domain.fr/logs/error.log
     CustomLog /var/www/appli1.domain.fr/logs/access.log common

     directory /opt/tomcat/webapps/appli1
     Options -Indexes
     /directory
 /VirtualHost

 However,when accessing to http://appli1.domain.fr, I am always redirected to
 the ROOT pages and not the appli1.

 I hope to be as clear as possible!

 Would you have some simple and elegant solution?

 Best regards,
 arnaud


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


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



RE: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-25 Thread Caldarale, Charles R
 From: Wesley Acheson [mailto:wesley.ache...@gmail.com] 
 Subject: Re: How to configure different default webapp in function of 
 requested hostname on one tomcat server

 You can configure the host element as per
 http://tomcat.apache.org/tomcat-6.0-doc/config/host.html

Also look at:
http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts

(Don't be scared off by the use of the word development in the above.)

 - 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 unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: How to configure different default webapp in function of requested hostname on one tomcat server

2010-08-25 Thread Hassan Schroeder
On Wed, Aug 25, 2010 at 9:13 AM, arnaud icard
arnaud.ic...@univ-avignon.fr wrote:

 The purpose of this server is to host multiple webapps (this one for
 instance : http://www.jasig.org/cas)
 For each of these webapps, we will contact the server with different urls :

 cas.domain.fr for the CAS webapp
 ent.domain.fr for the ENT webapp
 appli1.domain.fr for the appli1 webapp

 How can I do such a thing ?

Configure a Host element in server.xml for each of the above with
its own unique appBase, and make your app (e.g. CAS) the ROOT
webapp for that host.

Done.

If you really need Apache httpd for something else, then adjust your
forwarding appropriately. Otherwise you can remove it.

HTH,
-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

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