Description
Proposal Details
Proposal
This proposal is specifically talking about this line of code here:
Line 1926 in c2c4a32
My proposal is to add a line writing some error message to logs before returning the 400 error.
Motivation
Spent almost an hour today tracking down a bug which turned out to be due to Cloudflare proxy sending plain HTTP traffic (decrypted from TLS traffic) to my Go server which serves TLS.
It turns out that ListenAndServeTLS doesn't log any error messages when it receives a HTTP request, instead it just sends error: "Client sent an HTTP request to an HTTPS server." back to the client.
The problem is that my web browsers (tried both Firefox and Chrome, same result) don't display the message at all, it just shows an error 400 and that's it.
And in my Go program, there is no indication that it received any packets - no logging and there is no ability for me to add any logging to it at all.
I think the ideal solution would be to allow users to specify whether they want logging here, since some users might want it and some users might not.
But the simplest fix is to just add the logging for now.