Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / HTTP

Client Sent HTTP/1.1 Request Without hostname

1.00/5 (1 vote)
16 Aug 2017CPOL1 min read 13K  
Client sent HTTP/1.1 request without hostname

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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)