question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should use the user-provided Host header for SNI

See original GitHub issue

I’m trying to test Apache configuration in a Vagrant VM that forwards port 8443 to VM’s port 443. The command I’m running is:

$ http get https://localhost:443/ Host:www.example.com --verify=no

and I get a 400 Bad Request from Apache, because

[Mon Nov 23 09:43:17 2015] [error] Hostname localhost provided via SNI and hostname www.example.com provided via HTTP are different

I think httpie should use the user-provided Host header for the SSL negotiation, or perhaps even provide a command-line option to explicitly specify a hostname to use in SNI.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:6
  • Comments:10

github_iconTop GitHub Comments

6reactions
fdcdscommented, Jul 25, 2019

gnutls-cli has the --sni-hostname=... option. It would be great to have that for http too, and it would prevent unexpected effects when re-using the value of a header for a different purpose (TLS and HTTP live on different OSI layers, so should be treated independently).

4reactions
mgedmincommented, Nov 24, 2015

Good point about cookies! What about

http get https://foo.example.com/ --connect-to 127.0.0.1:8443

then?

I don’t like curl’s --resolve solution (aka #362) because it requires me to repeat the host name, which is unnecessary in 99% of use-cases. (It’s probably necessary if you want to follow redirects to a different domain name, that you’re also testing in Vagrant or something like that.)

I don’t like the /etc/hosts solution because:

  • it requires root
  • it affects the entire system, not just my little experimental shell session
  • it’s persistent and I have to remember to undo any testing changes I make
Read more comments on GitHub >

github_iconTop Results From Across the Web

SNI and Http Host header - Ravi Somepalli
Enter host header, web browsers will send a header as part of the http protocol that identities the requested domain name.
Read more >
Should use the user-provided Host header for SNI #414 - GitHub
I think httpie should use the user-provided Host header for the SSL negotiation, or perhaps even provide a command-line option to explicitly ...
Read more >
The curious case of curl, SSL SNI and the HTTP Host header
"SNI sends the hostname inside the TLS handshake (ClientHello). The server then chooses the correct certificate based on this information. Only ...
Read more >
What is SNI? How TLS server name indication works
SNI, or Server Name Indication, is an extension for the TLS protocol to indicate a hostname in the TLS handshake. Learn more about...
Read more >
tls - Host header is preferred by OpenSSL over SNI
The TLS session establishment does not take into account the Host: header of the HTTP request at all, so OpenSSL doesn't prefer the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found