Hi,
I'm running the 2016-11-11 amd64 snapshot on a VMWare test host,
working with patterns in httpd's server statements. Here's my
/etc/httpd.conf:
--
public_ip="*"
public_ip6="::"
server "default" {
root "/default"
listen on $public_ip port 80
listen on $public_ip6 port 80
}
server match "^[w]+%.mwlucas%.org$" {
listen on $public_ip port www
listen on $public_ip6 port 80
root "/www1"
directory auto index
}
--
My understanding of what this should do is:
Requests that match one or more 'w's.mwlucas.org (i.e.,
www.mwlucas.org, w.mwlucas.org, wwwwww.mwlucas.org, etc) should hit
the server with the match statement.
Other requests to the server, such as by raw IP, a plain
"mwlucas.org," or any other hostname pointed at that IP address,
should get the default entry.
Each site only contains a single document, giving the site name in
large letters.
Instead, it seems that every request hits the match statement.
Running the server in debug mode:
# httpd -dvvvvvvv
startup
server_privinit: adding server default
socket_rlimit: max open files 1024
socket_rlimit: max open files 1024
socket_rlimit: max open files 1024
server_privinit: adding server default
server_privinit: adding server ^[w]+%.mwlucas%.org$
server_privinit: adding server ^[w]+%.mwlucas%.org$
server_launch: configuring server default
server_launch: running server default
server_launch: configuring server default
server_launch: running server default
server_launch: configuring server default
server_launch: running server default
server_launch: configuring server default
server_launch: running server default
server_launch: configuring server default
server_launch: running server default
server_launch: configuring server default
server_launch: running server default
Lynx on another workstation. Requesting www.mwlucas.org works as expected:
^[w]+%.mwlucas%.org$ 203.0.113.208 - - [11/Nov/2016:16:35:00 -0500] "GET /
HTTP/1.0" 200 51
server default, client 1 (1 active), 203.0.113.208:15679 -> 192.0.2.101, done
Let's try plain mwlucas.org. That doesn't have any leading w or the
explicit period, I'd expect it to hit the default server.
^[w]+%.mwlucas%.org$ 203.0.113.208 - - [11/Nov/2016:16:37:34 -0500] "GET /
HTTP/1.0" 200 51
server default, client 1 (1 active), 203.0.113.208:62794 -> 192.0.2.101, done
Something without any host name in it: browse by IP:
^[w]+%.mwlucas%.org$ 203.0.113.208 - - [11/Nov/2016:16:38:13 -0500] "GET /
HTTP/1.0" 200 51
server default, client 1 (1 active), 203.0.113.208:61442 -> 192.0.2.101, done
It seems that no matter how I get to this host, I get the server with
the match statement.
I've tried variants on the pattern. It seems that a simpler pattern
should work, like:
server match "w+.mwlucas.org" {
but it seems all requests still go to the match statement server.
If I remove the match statement from httpd.conf and rely on something like
server www.mwlucas.org {
requests go to either the default server or, if I specifically request
that hostname, the named server.
Any suggestions? What am I missing to use patterns in a server entry?
Thanks,
==ml
--
Michael W. Lucas - [email protected], Twitter @mwlauthor
http://www.MichaelWLucas.com/, http://blather.MichaelWLucas.com/