www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lew Payne <le...@netcom.com>
Subject config/710: IP-based VirtualHosts Broken.
Date Tue, 10 Jun 1997 04:40:02 GMT

>Number:         710
>Category:       config
>Synopsis:       IP-based VirtualHosts Broken.
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    apache (Apache HTTP Project)
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Mon Jun  9 21:40:01 1997
>Originator:     lewiz@netcom.com
>Organization:
apache
>Release:        Apache/1.2.0
>Environment:
FreeBSD lppi.com 2.2.1-RELEASE FreeBSD 2.2.1-RELEASE #0: Fri Jun  6 19:20:41 PDT 1997
        lewis@lppi.com:/usr/src/sys/compile/WWW  i386
>Description:
  Requests for a particular IP address, as defined in <VirtualHost>
directives, are ignored if the ServerName within the directive does
not match the browser's request!  That is, IP-based virtual hosts do
not work properly -- They are matched according to non-IP host rules.
This causes a big problem for browsers that do not supply the server
name in their request, and for browsers reaching the site via one of
its aliases, such as "site.com" in lieu of "www.site.com".

DNS configuration:
------------------
persiankitty.com      A  209.81.0.2
                      A  209.81.0.3

www.persiankitty.com  A  209.81.0.2
                      A  209.81.0.3

www.pay4play.com      A  209.81.0.6
pay4play.com          A  209.81.0.6

  A request for 209.81.0.2, with a supplied matching servername of
"www.persiankitty.com" gets set to the right VirtualHost.  The same
IP request, with a non-matching name of "persiankitty.com" does not
get processed by IP -- it goes to the default host.  A ServerAlias
directive might help this, but that still leaves a problem:  An IP
request, with NO servername specified by the browser, does not get
processed by IP -- it goes to the default host also.  Enabling and
monitoring logs proves my conclusion.
  As a test, I removed the "ServerName" directive from <VirtualHost>.
In that instance, requests with NO servername specified went to the
correct VirtualHost.  However, requests with either name specified
went to the default host.  Consistent with my theory.
  This applies to any of the IP addresses my systems hosts.  This
same behavior is seen on all three of my server machines!!!

ifconfig fxp0
-------------
fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 209.81.0.2 netmask 0xffffff00 broadcast 209.81.0.255
        inet 209.81.0.3 netmask 0xffffff00 broadcast 209.81.0.255
        inet 209.81.0.6 netmask 0xffffff00 broadcast 209.81.0.255
        ether 00:a0:c9:59:b5:e0

Relevant httpd.conf items:
-------------------------
ServerName     www.persiankitty.com
ServerAdmin    lewis@persiankitty.com
ServerRoot     /usr/local/etc/httpd
ErrorLog       logs/error_log
TransferLog    logs/default_log
LogFormat      "%{[%D-%T]}t %{host}i %h [%T] %b \"%r\" %>s"
CustomLog      logs/refer_log "%{referer}i -> %U"
PidFile        /var/run/httpd.pid

<VirtualHost 209.81.0.2 209.81.0.3>
  ServerAdmin   lewis@persiankitty.com
  ServerName    www.persiankitty.com
  DocumentRoot  /home/persian/public_html
  #LogFormat    "%{%D %T}t [%T] %h %b \"%r\" %>s"
  TransferLog   /dev/null
  #ErrorLog     /home/persian/logs/error_log
  AddType       application/x-httpd-php .html
</VirtualHost>

<VirtualHost 209.81.0.6>
  ServerAdmin   lewis@persiankitty.com
  ServerName    www.pay4play.com
  DocumentRoot  /home/p4play/public_html
  LogFormat     "%{%D %T}t [%T] %h %b \"%r\" %>s"
  TransferLog   /home/p4play/logs/trans_log
  ErrorLog      /home/p4play/logs/error_log
  AddType       application/x-httpd-php .html
</VirtualHost>
>How-To-Repeat:
Simple!!  Go to http://209.81.0.6/ and then to www.pay4play.com --
both should send you to the same virtual host, but they don't !!
>Fix:
Clean up non-IP based virtual hosting code, which seems to have
bled into IP-based virtual hosting code
>Audit-Trail:
>Unformatted:



Mime
View raw message