1. 29
  1.  

  2. 10

    I am most curious why the response to an “invalid” host header would be a 418 error.

    1. 9

      Note: you may get the impression this is proxy’s fault, but it isn’t. Host: registry.npmjs.org:443 is, although unusual, a valid HTTP request. (Host: registry.npmjs.org is usual.) It’s NPM registry that is in violation of HTTP standard here.

      1. 6

        Huh, interesting, I definitely would have assumed that it would only include the “host”, but you’re totally right:

        Host = "Host" ":" host [ ":" port ] ; Section 3.2.2

        https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23

        1. 2

          That is kinda weird/interesting. If browsers did report the port, I could see mismatched Host header vs real port when behind a load balancer (typically handled by the load balancer adding X-Forwarded-For headers). But most browsers probably don’t do this, unless it’s a totally non-standard port?

          1. 2

            You can also mismatch TLS Server Name Indication and Host header. For example, nginx treats TLS and HTTP separately so it does not care if it mismatches.