Bug #709

simple vhost default root change incorrectly handled

Added by Anonymous almost 8 years ago. Updated over 5 years ago.

Status:FixedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:mod_simple_vhost
Target version:1.4.21
Missing in 1.5.x:

Description

It appears that if I change simple vhost default host (eg. a specific default host for a specific ip range), the server doesn't serve default host if an invalid vhost was attempted to be reached, unless the default host itself has been accessed at least once before, and the original default host is served instead.

Steps to reproduce are, apparently:
a) {{{
simple-vhost.server-root = "/srv/www-vhosts/
simple-vhost.default-host = "some.domain.tld"
simple-vhost.document-root = "/"
}}}

b)
 {{{
$HTTP[[remoteip]] == "192.168.0.0/16" {
simple-vhost.default-host = "another.tld"
} # the ip range is just sample, obviously
}}}
and restart server
c)
 {{{
mkdir -p /srv/www-vhosts/{some.domain.tld,another.tld}
}}}
d) from ip within range of 192.168.0.0/16:
 {{{
echo -ne "GET / HTTP/1.0\r\nHost: nonexistent.tld\r\n\r\n" | netcat the.http.server 80
}}}
e) This will serve "some.domain.tld" instead of "another.tld"
f)
 {{{
echo -ne "GET / HTTP/1.0\r\nHost: another.tld\r\n\r\n" | netcat the.http.server 80
}}}
g) This will properly serve another.tld
h) Repeat d) and it will properly serve another.tld

-- iSteve

History

#1 Updated by stbuehler over 5 years ago

The caching fails; so perhaps we shouldn't cache for the default vhost. I don't caching is needed anyway, as a stat call for the last used vhost shouldn't be a big performance hit - the kernel should have that information still in the cache anyway.

#2 Updated by stbuehler over 5 years ago

  • Status changed from New to Fixed
  • Resolution set to fixed

Fixed in r2322

Also available in: Atom