Introduction
I use Apache httpd 2.2 server for a number of applications that I develop, and after using the command:
yum update
and then after an update to httpd, I’ve sometimes seen the following type error message in the httpd error logs:
[Wed Aug 16 14:56:55 2017] [error] [client 192.168.0.2]
client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /
This article is about how to resolve this issue.
How I Found the Problem
I had added a new VirtualHost to my httpd.conf file and then restarted the httpd server and then tried to use a browser to enter the URL with the hostname as specified in the VirtualHost config. However, I noticed the response was referring to another config. I changed to the “/var/log/httpd” folder and looked at the respective httpd error log file and saw the “client sent HTTP/1.1 request without hostname” error message.
This was weird because it was going to the wrong VirtualHost config. I double-checked that my client had the correct hosts file entry (On Windows, this is the “C:\Windows\System32\drivers\etc\hosts” file), and also the server hosts file was correct.
How to Resolve the Issue
In order to resolve the issue, edit the httpd.conf file and then uncomment the following line:
#HttpProtocolOptions Unsafe
After making the above change (un-commenting the line), you need to restart the httpd server:
service httpd restart
Then if you refresh the web application that you are trying to access, you will no longer receive the “client sent HTTP/1.1 request without hostname” error message.
Tagged: Apache