-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 André,
On 7/18/12 5:33 AM, André Warnier wrote: > I don't find in the on-line documentation a description of how > Tomcat exactly matches HTTP requests to <Host> names, but the > general logic in webservers is something like : - consider the > "Host:" header of the request - try to match it to one of the > defined hostnames in the server configuration - if it matches, then > handle this request as per the configuration of that (virtual) > host - if it doesn't match, then handle the request with the > configuration of whatever <Host> is defined as the default Host. This is correct. > In Apache httpd, if you have a single Host defined, it > automatically becomes the default Host. In Tomcat however, even if > you have a single Host defined, it is not automatically the default > Host. You must explcitly name this default Host in the > "defaultHost" attribute of the <Engine> tag. I'll have to check on this: I think there is a *default* default host (which may be the only host, though it might be possible to specify that there is no default Host and therefore requests that don't match a Host are ... dropped? 400? I dunno: the OP still won't tell us what the failure behavior is. > So maybe your (1) above initialises some internal structure which > fills in the "default host" value. The default value for the host is "localhost". Calling getEngine() ultimately calls getHost() which provides the default Host ("localhost") and the default hostname ("localhost"). The code for the Tomcat class is very readable. > Anyway, if the Engine's defaultHost is set correctly (to > "localhost" e.g.), then you should not normally need to add the > "127.0.0.1" Alias (as all requests should default to that > defaultHost anyway). So to me, there is still something somewhat > unsatisfactory in having to do (2) above. I wonder if calling start() before calling addWebapp() is part of the problem. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlAG1TYACgkQ9CaO5/Lv0PBMiACePr+Bw01NwN5POGBJgCpa03n1 nesAn1cbQ8/8fsVWQuAfPFnmVZjTa9zu =e0dw -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org