"Pier P. Fumagalli" wrote:
> 
> Finishing up the last few glitches of the webapp_module and I found a couple
> of inconsistencies between Apache, the servlet spec and Tomcat.
> 
> I have a couple of virtual hosts on the same IP address on two ports under
> apache:
>     www.betaversion.org
> And
>     kali.betaversion.org
> 
> They use both ports 80 and 8080, BUT I have only one definition for the
> server: www:80 (www:8080, kali:80 and kali:8080 are configured to be exactly
> equal to www:80).

Are you using VirtualHosts and ServerAlias? If you do, then you
will get what you expect from cgi progs as well (I *think*?).

alas:

<VirtualHost 1.2.3.4:80>
  ServerName  www.betaversion.org
  ServerAlias kali.betaversion.org
...
</VirtualHost>

<VirtualHost 1.2.3.4:8080>
  ServerName  www.betaversion.org
  ServerAlias kali.betaversion.org
...
</VirtualHost>

or, if you don't use VirtualHosts, use the UseCanonicalName
directive
<http://apache.archive.sunet.se/docs/mod/core.html#usecanonicalname>


> So, something is wrong, since the spec says that calling
>     ServletRequest.getServerName() is equal to the SERVER_NAME CGI variable
> And
>     ServletRequest.getServerPort() is equal to the SERVER_PORT CGI variable
> 

As you see, this depends on configuration.

> At the end, what should I use? Wich one is correct? The CONFIGURED server
> name and port or the one derived from the Host: ...... Header????
> (Right now I'm using the second one, like Tomcat does)...

Stick with this, IMHO. The configured name is of less interest,
right?

/Palle

Reply via email to