Hi Larry,

My comments are interspersed...   :)

----- Original Message -----
From: "Larry Isaacs" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 20, 2001 12:48 PM
Subject: RE: VHosts causing app to load twice


> Hi Jeff,
>
> Maybe I can increase my understanding here, since I not
> that experienced with the Apache side.
>
> The point of:
>
> NameVirtualHost 111.22.33.44
>
> <VirtualHost 111.22.33.44 >
>    ServerName www.foo.com
>     ...
> </VirtualHost>
>
> was that mod_jk would identify the host as "www.foo.com"
> for both Both "http://111.22.33.44/..."; and
> "http://www.foo.com/...";.  Thus, Tomcat could match it to a
> single context identified by "www.foo.com".  I can't claim to
> understand the NameVirtualHost directive very well, but without
> it, I believe that mod_jk would identify the host as
> "111.22.33.44" instead of "www.foo.com" for
> "httpd://111.22.33.44/...".

Ok, now I see the problem that you're describing. However, I still think
this can be solved with an IP-based vhost where the config would be:

<VirtualHost 111.22.33.44>
  ServerName "www.foo.com"
  ....
</VirtualHost>

Notice there's no NameVirtualHost directive. Here we're telling Apache that
every request that comes in on this IPAddress will have it's ServerName set
to www.foo.com. The only time you would need the NameVirtualHost directive
is if you want to set up more domains with the same IP. For example:

NameVirtualHost 111.22.33.44

<VirtualHost 111.22.33.44>
  ServerName "www.foo.com"
  .....
</VirtualHost>

<VirtualHost 111.22.33.44>
  ServerName "www.bar.com"
  .....
</VirtualHost>

Now, Apache will use the "host" header supplied by the browser to figure out
which vhost to send the request to. If no "host" header is supplied, I
believe it defaults to the first vhost in the list -- problematic for
browsers that don't supply a "host" header.

I don't think there's that big of a difference between the way you had it
and my first config above, just saves a bit of typing in httpd.conf and
looks cleaner from an Apache point of view. The results are probably the
same...

> Obviously, I'm coming at this from the point of view of
> keeping mod_jk and Tomat happy, and not necessarily what
> is "normal" for Apache.
>
> By the way, ApacheConfig in Tomcat 3.3 also supports the
> following for "ServerAlias":
>
> server.xml:
>   <Host name="www.foo.com" address="111.22.33.44" >
>     <Alias name="www.bar.com" />
>     <Context ... />
>   </Host>
>
> which would generate conf/auto/mod_jk.conf:
>
>   NameVirtualHost 111.22.33.44
>
>   <VirtualHost 111.22.33.44 >
>     ServerName www.foo.com
>     ServerAlias www.bar.com
>     ...
>   </VirtualHost>
>
> Cheers,
> Larry

Cool! This is what I was looking for in 3.2.x. Any hopes of migrating this
back into 3.2.4 or later? Kinda silly not to have this functionality. Also,
can you have multiple "Alias" directives? (I'm not even sure if you can do
that in Apache...)

Thanks,
--jeff


Reply via email to