You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by "Steven E.Brenner" <se...@akamail.com> on 1998/09/19 02:49:46 UTC

general/3029: NameVirtualHost and Port Numbers: One hosts captures all connections to other ports

>Number:         3029
>Category:       general
>Synopsis:       NameVirtualHost and Port Numbers: One hosts captures all connections to other ports
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Fri Sep 18 17:50:00 PDT 1998
>Last-Modified:
>Originator:     seb@akamail.com
>Organization:
apache
>Release:        1.3.1
>Environment:
Linux lw1.stanford.edu 2.0.30 #1 Wed Jun 4 15:02:33 EDT 1997 i686 unknown
gcc version 2.7.2.1
>Description:
Greetings,

I have a server which serves several Name-Based Virtual hosts, on
several ports.  Behavior on the 'main' port (80) is fine.  However, 
all accesses to the other 'Listen' ports go to the first VirtualHost listed 
with that port.  The name of the host appears to be ignored.

Following is the VirtualHosts section of my configuration.  Following 
is where the server actually takes me.

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the VirtualHost command

# Pub server
Listen 80
# Tst server
Listen 1234
# Dev server 
Listen 9876

#Listen 12.34.56.78:80

# VirtualHost: Allows the daemon to respond to requests for more than one
# server address, if your server machine is configured to accept IP packets
# for multiple addresses. This can be accomplished with the ifconfig 
# alias flag, or through kernel patches like VIF.

# Any httpd.conf or srm.conf directive may go into a VirtualHost command.
# See also the BindAddress entry.


NameVirtualHost 171.65.16.192
 
<VirtualHost 171.65.16.192:80>
#ServerAdmin brenner@hyper.stanford.edu
DocumentRoot /maxa/usr/www/csb/pub
ServerName   csb.stanford.edu
ServerAlias  csb
Port         80
ErrorLog     logs/csb-pub-error_log
TransferLog  logs/csb-pub-access_log
</VirtualHost>

<VirtualHost 171.65.16.192:80>
#ServerAdmin brenner@hyper.stanford.edu
DocumentRoot /maxa/usr/www/dd/pub
ServerName   dd.stanford.edu
ServerAlias  dd
Port         80
ErrorLog     logs/dd-pub-error_log
TransferLog  logs/dd-pub-access_log
</VirtualHost>

<VirtualHost 171.65.16.192:80>
#ServerAdmin brenner@hyper.stanford.edu
DocumentRoot /maxa/usr/www/presage/pub
ServerName   presage.stanford.edu
ServerAlias  presage
Port         80
ErrorLog     logs/presage-pub-error_log
TransferLog  logs/presage-pub-access_log
</VirtualHost>

<VirtualHost 171.65.16.192:1234>
#ServerAdmin brenner@hyper.stanford.edu
DocumentRoot /maxa/usr/www/presage/tst
ServerName   presage.stanford.edu
ServerAlias  presage
Port         1234
ErrorLog     logs/presage-tst-error_log
TransferLog  logs/presage-tst-access_log
</VirtualHost>

<VirtualHost 171.65.16.192:9876>
#ServerAdmin brenner@hyper.stanford.edu
DocumentRoot /maxa/usr/www/presage/dev
ServerName   presage.stanford.edu
ServerAlias  presage
Port         9876
ErrorLog     logs/presage-dev-error_log
TransferLog  logs/presage-dev-access_log
</VirtualHost>

<VirtualHost _default_:*>
DocumentRoot /maxa/usr/www/default/pub
ServerName   lw1.stanford.edu
ErrorLog     logs/default-error_log
TransferLog  logs/default-access_log
</VirtualHost>

<VirtualHost 171.65.16.192:1234>
DocumentRoot /maxa/usr/www/default/pub
ServerName   lw1.stanford.edu
Port         1234
ErrorLog     logs/default-error_log
TransferLog  logs/default-access_log
</VirtualHost>

<VirtualHost 171.65.16.192:9876>
DocumentRoot /maxa/usr/www/default/pub
ServerName   lw1.stanford.edu
Port         9876
ErrorLog     logs/default-error_log
TransferLog  logs/default-access_log
</VirtualHost>



When I access the following sites, I go to the correct locations:
http://dd.stanford.edu/
http://csb.stanford.edu/
http://lw1.stanford.edu/
http://presage.stanford.edu/
http://presage.stanford.edu:1234/
http://presage.stanford.edu:9876/

I would expect (because of the _default_:*) entry, that 
http://csb.stanford.edu:1234/ would take me to ...default/pub

Further, I would expect that
http://lw1.stanford.edu:1234/ (which has an explicit VirtualHost entry)
would also take me to ...default/pub

However, in both cases, I am taken to ...presage/tst.
Indeed, access to ANY server name on port 1234 takes me to ..presage/tst
    and access to ANY server name on port 9876 takes me to ..presage/dev

Further, I have discovered that the location I am taken to for *:1234 and *:9876
is dependent upon the orderng of entries in httpd.conf  If I move the
VirtualHost for lw1.stanford.edu, Port 1234 to the top of the file, then
*:1234 (including presage.stanford.edu:1234) takes me to default/pub
>How-To-Repeat:
See above
>Fix:
None obvious.  Thanks for your help.
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <ap...@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]
[If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request ]
[from a developer.                                      ]
[Reply only with text; DO NOT SEND ATTACHMENTS!         ]