httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: [BUG]: "SERVER_NAME environment variable not always fully expanded (resolved)" on Irix (fwd)
Date Mon, 03 Mar 1997 14:49:17 GMT
That looks like you're interested in knowing what the user typed into the
client, which strictly speaking is impossible to know.  For example, I can
map foobar.arctic.org to ftp.cs.umn.edu and telnet to foobar.arctic.org
and your httpd would have no idea what I typed.  For an approximation of
what you want you should look at the HTTP_HOST environment variable.  That
is set to the value of the "Host:" header sent in the client request, if
any was sent.  This header isn't required under HTTP/1.0, but netscape 2
and above sends it. 

The example you gave below works because the browser you're using is
probably netscape 2+ or MSIE 2+.  It's sending a Host: header and apache
is able to decide between the different vhosts. 

How do you mean ServerName works differently?  Everything outside a vhost
is essentially a default, and specific vhosts override it.

Dean

On Mon, 3 Mar 1997, Mark A. Bentley wrote:

> On Sun, 2 Mar 1997, Dean Gaudet wrote:
> 
> > The SERVER_NAME is set according to the ServerName directive.  It's up to
> > you to set the ServerName properly.  If you have multiple virtual hosts
> > then it's up to you to configure ServerName in each VirtualHost section.
> > 
> > Dean
> > 
> 
> So I must have three VirtualHost sections for each host like this:
> 
> <VirtualHost ftp.cs.umn.edu>
> User cgi
> Group cgi
> DocumentRoot /export/servers/web/root/htdocs
> ServerName ftp.cs.umn.edu
> </VirtualHost>
> 
> <VirtualHost ftp.cs.umn.edu>
> User cgi
> Group cgi
> DocumentRoot /export/servers/web/root/htdocs
> ServerName ftp.cs
> </VirtualHost>
> 
> <VirtualHost ftp.cs.umn.edu>
> User cgi
> Group cgi
> DocumentRoot /export/servers/web/root/htdocs
> ServerName ftp
> </VirtualHost>
> 
> This works, and it is the workaround I'm using for the described bug.
> ServerName does work differently outside of a VirtualHost section
> however.  Why the inconsistancy?
> 
> > On Mon, 3 Mar 1997, Rob Hartill wrote:
> > 
> > > 
> > > Sounds backwards to me.
> > > 
> > > ---------- Forwarded message ----------
> > > Date: Sun Mar  2 16:05:24 1997
> > > From: bentlema@cs.umn.edu
> > > To: apache-bugs%apache.org@organic.com
> > > Subject: [BUG]: "SERVER_NAME environment variable not always fully expanded
(resolved)" on Irix
> > > 
> > > Submitter: bentlema@cs.umn.edu
> > > Operating system: Irix, version: 6.2
> > > Version of Apache Used: 1.2b6
> > > Extra Modules used: 
> > > URL exhibiting problem: 
> > > 
> > > Symptoms:
> > > --
> > > I depend on the SERVER_NAME environment variable in CGI scripts, especially
for
> > > determining which domain a request came through on a multi-honed server.  The

> > > problem is it's not always set to the fully qualified host.domainname format.
> > > 
> > > If you could guarantee that SERVER_NAME is *always* set to the fully qualified

> > > host.domainname, regardless of the host specified in the URL, it would help
a lot.
> > > --
> > > 
> > > Backtrace:
> > > --
> > > 
> > > --
> > > 
> > > 
> > > 
> > 
> 
> 
> --
> Mark A Bentley			Email:	bentlema@cs.umn.edu
> Systems Staff, CSci Dept
> University of Minnesota 	URL:	http://www.cs.umn.edu/~bentlema/
> 
> 


Mime
View raw message