-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bunyan CLI reports wrong "Host" header for client requests using default port #504
Comments
Here is the code where node is adding the "Host" header: https://github.com/nodejs/node/blob/v6.10.3/lib/_http_client.js#L88-L105 That behaviour can depend on:
Anyway, that is more colour for why we can't reliably guess what node is going to do here. Also, who says this is a Another issue I believe, is that the Ideas:
Notice the |
Proposal for Bunyan 1.x:
Proposal for Bunyan 2.x:
|
^^^ that commit is the proposed change for 1.x |
^^^ that commit for bunyan 2.x proposed change. |
published [email protected] (latest) and [email protected] (beta) to npm |
I've been trying to debug a problem involving an HTTP client sending the wrong Host header. The background is in node-manta#306. I was thrown off because the bunyan CLI reported the wrong "Host" header.
With bunyan logging enabled, the client reports this (I've removed my own key signature from all of these outputs):
If you run this second log entry through json(1), you can see that the "client_req" object is accurate:
but if you run this through the bunyan CLI:
bunyan is printing this out like it's the headers of an HTTP request, with the "Host:" header having value "127.0.0.1:80". But that's wrong. I ran this against a local "nc" server and saw that the Host header received was:
That's because Node omits the port when it matches the default for the protocol.
I'm not sure what the best fix is. bunyan could try to mimic Node's logic here, but that's fraught if Node ever changes its behavior. I understand why we want to report this header, but there's no way to know what Node really sent, and it's really confusing when it gets this wrong. Maybe we could report this as "expected headers" or "requested headers" (and leave out Host) instead of reporting it as though it were the actual HTTP request line?
The text was updated successfully, but these errors were encountered: