I have just start 2 new Nodejs project moved from Heroku, using builder = “heroku/buildpacks:20”. Both are the expressjs sites. Everything seemed to be fine.
But after the site sat for few hours, I take a look at the “Monitoring” screen. There are these logs in the window on both of the projects.
Error: no host specified in headers or uri Error: no host specified in headers or uri
That can happen if you’re using the force_https handler and your app gets an HTTP request without a Host header or the full hostname (http/2) in the URI.
In these situation our proxy returns a 400 response code and we log it.
Am glad this question got asked, as I’ve been wondering the same thing since migrating over.
@jerome Did you mistype your response? Did you actually mean to write “without a Host header or a hostname”? Regardless, would you mind providing some context or background information regarding your response? (Or a pointer to such info?) It isn’t clear to me what the root issue here is. How would an HTTP request ever be received without a hostname? By “hostname”, you mean something akin to “www.google.com”, correct? Thank you in advance.
Things that crawl the internet won’t include a hostname. HTTP 1.0 didn’t require a host header, HTTP 1.1 does. So things that aren’t doing proper HTTP 1.1 are usually the culprit.
This error probably doesn’t affect your app. It probably means some bot from the internet sent a bad request to your IP.