Apache VirtualHost error: Invalid host name

It used to be pretty simple for me to set up a VirtualHost to test a new php webapp, for this http.conf:

NameVirtualHost *:80

<VirtualHost *:80>
        DocumentRoot /opt/webgrind/www
        ServerName webgrind
</VirtualHost>
<VirtualHost *:80>
        DocumentRoot /opt/opencart/www
        ServerName opencart
</VirtualHost>

I just needed to restart the service and access: http://webgrind/ or http://opencart/ (without changing anything in /etc/hosts)

But something changed in the server (CentOS 6) and now the error.log states:

[error] avahi_entry_group_add_service_strlst("opencart") failed: Invalid host name
[error] avahi_entry_group_add_service_strlst("webgrind") failed: Invalid host name

And when accessing http://webgrind/ I get a page ofline error. Any ideas?

Server version: Apache/2.2.15 (Unix) Server built: Dec 8 2011 18:10:49


Since this question is the first that shows up when searching for "AH02415: [strict] Invalid host name", I will add an answer to document the time I wasted today because most of the virtual hosts in my development machine stopped working (e.g. shop_one.web).

I had Apache updated to version 2.4.16-18.1 and apparently HttpProtocolOptions now defaults to Strict, thus rejecting my local hostnames that have '_' (underscore) in them (and probably those of the OP).

I know they are not proper hostnames, but for local/personal use never hurt anybody, so I added the line:

HttpProtocolOptions Unsafe

to my default-server.conf and life is back to what it was before. See also:

https://httpd.apache.org/security/vulnerabilities_24.html

https://unix.stackexchange.com/questions/340013/why-am-i-getting-400-bad-request/341306