5

I'm getting a bunch of these errors in my error.log:

[client 1.2.3.4] proxy: no HTTP 0.9 request (with no host line) on incoming request and preserver hose set forcing hostname to be www.mydomain.com for uri /

My config is essentially:

ProxyRequests Off

<VirtualHost 1.2.3.4:80>
ServerName www.mydomain.com
DocumentRoot "c:/apache/htdocs"

ProxyPreserveHost On
ProxyPass / http://172.1.1.1/
</VirtualHost>

<VirtualHost 1.2.3.4:443>
ServerName www.mydomain.com
DocumentRoot "c:/apache/htdocs"
# SSL Stuff

ProxyPreserveHost On
ProxyPass / http://172.1.1.1/
</VirtualHost>

Anyone have an idea how to eliminate those warnings?

ConsultUtah
  • 259
  • 1
  • 3
  • 13
  • Is the client address your server? – Shane Madden Jun 20 '12 at 18:42
  • No, sorry. I just tried to anonymize the ip's to protect the guilty. – ConsultUtah Jun 20 '12 at 19:01
  • Well, that warning just informs you that you have `ProxyPreserveHost` set and got a request with no `Host` header, so the server needed to improvise a header to send to the proxy backend. You can ignore the error, especially because those `HTTP/0.9` clients are usually bots, not actual users. – Shane Madden Jun 20 '12 at 19:04
  • OK. Looks like you are right. They are coming from a server iron and our monitoring servers. Thanks! Wanna post your answer as an answer and I'll mark it? – ConsultUtah Jun 20 '12 at 19:30

1 Answers1

5

These warnings are just making the effort to inform you that Apache has done something not-quite-alright (injecting a Host header in a request that didn't have one) in an effort to make sure the client can access the proxied content.

Since ProxyPreserveHost On is set, Apache presumes that the backend server won't be ok with having a Host header of 172.1.1.1, nor does it really know how to speak HTTP/0.9 to the backend server.. so it's improvising a bit, in the hopes that it works correctly, but informing you of that.

Generally, these can be ignored, which can unfortunately add noise to your logs. Additionally, it's extraordinarily rare that a request like this comes from a human's web browser (the exception being possibly some older proxies); more likely it's a bot of some sort.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251
  • Note that if the "bot" accessing your web server is your own Nagios monitoring system you may need to change your Nagios config to specify the hostname to use with a line like `check_command check_http!"--hostname=www.mydomain.com"` in your service definition, even if your host definition uses the name rather than IP. – BeowulfNode42 Oct 10 '16 at 08:13