What you’ll get
Run curl -vI https://example.org to inspect all three top layers in one output: TCP connect, the TLS 1.3
handshake with HTTP/2 selected via ALPN, and the HTTP response headers:
curl -vI https://example.org
# * Trying 203.0.113.10:443...
# * Connected to example.org (203.0.113.10) port 443
# * ALPN: curl offers h2,http/1.1
# * SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / X25519 / id-ecPublicKey
# * ALPN: server accepted h2
# * Server certificate:
# * subject: CN=example.org
# * start date: Sep 26 22:05:05 2026 GMT
# * expire date: Dec 25 22:13:27 2026 GMT
# * subjectAltName: host "example.org" matched cert's "example.org"
# * issuer: C=US; O=SSL Corporation; CN=Cloudflare TLS Issuing ECC CA 3
# * SSL certificate verify ok.
# * using HTTP/2
# > HEAD / HTTP/2
# > Host: example.org
# < HTTP/2 200
# < content-type: text/html; charset=utf-8
# < cache-control: max-age=14400
# < alt-svc: h3=":443"; ma=86400
That single SSL connection using… line describes every parameter of the encrypted channel:
curl prints the certificate fields (subjectAltName, issuer, dates) and sends HEAD / HTTP/2 only after SSL certificate verify ok.What happens between TCP and the first byte of HTML
Once the TCP handshake opens port 443 (TCP: flags and states), the channel is still plaintext. TLS 1.3 runs first:
TCP established (:443)
- ClientHello
SNI · ALPN · keyThe client sends the target hostname in theSNIextension, its supportedALPNprotocols (h2, http/1.1), and itsX25519key share. - ServerHello + Cert
1 RTT in TLS 1.3The server picks the matching certificate bySNI, replies with its key share, turns on encryption immediately, and sends the certificate chain and signature already encrypted. - Certificate check
SAN · dates · CAThe client checks three conditions: the hostname matchessubjectAltName, current time falls betweenstartandexpire, and the signature chain leads to a root CA in the local trust store. - HTTP exchange
HEAD / · 200 OKThe channel is verified and encrypted. The HTTP request (GET/POST, headers,Host: example.org) goes out and the status code and body return.
HTTP/2 200 OK (inside TLS)
Why SNI exists (Server Name Indication, RFC 6066). One server on a single IP 203.0.113.10 often hosts
dozens of sites behind Traefik or nginx (Traefik). The HTTP Host: example.org header travels only
after TLS is up, yet the server must pick a certificate before that. The client solves this by sending the domain
name up front inside the SNI extension of the first ClientHello packet.
Check which certificate a server returns for a given SNI (and whether fullchain is in place) with openssl s_client — the -servername flag sets SNI:
openssl s_client -connect 203.0.113.10:443 -servername example.org </dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates
# subject=CN = example.org
# issuer=C = US, O = SSL Corporation, CN = Cloudflare TLS Issuing ECC CA 3
# notBefore=Sep 26 22:05:05 2026 GMT
# notAfter=Dec 25 22:13:27 2026 GMT
Three TLS verification patterns
- ClientHello✓ SNI: example.org
- Server :443✓ fullchain + ALPN h2
- CA check✓ SAN and dates valid
- HTTP/2✓ 200 OK
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / X25519 * subjectAltName: host "example.org" matched cert's "example.org" * SSL certificate verify ok. < HTTP/2 200
The server selected the certificate by SNI, sent the full chain to a trusted CA, and negotiated HTTP/2.
curl -vI https://example.org
- ClientHello✓ SNI: shop.example.org
- Proxy :443✕ served default cert
- SAN check✕ hostname mismatch
- curl (exit 60)✕ aborted before HTTP
* Server certificate: subject: CN=TRAEFIK DEFAULT CERT curl: (60) SSL: no alternative certificate subject name matches target host name 'shop.example.org'
The reverse proxy had no certificate for shop.example.org (or no router for that hostname) and fell back to its self-signed default cert.
openssl s_client -connect 203.0.113.10:443 -servername shop.example.org </dev/null
- Server :443✕ served cert.pem only
- Browser✓ fetched chain itself
- curl / Python✕ chain stopped short of root
curl: (60) SSL certificate problem: unable to get local issuer certificate # openssl s_client -showcerts prints only one certificate (depth=0) instead of a chain
The web server config points to the leaf certificate instead of fullchain.pem: browsers hid the gap via AIA caching while scripts and APIs failed.
openssl s_client -showcerts -connect example.org:443 -servername example.org </dev/null
HTTP status codes and versions HTTP/1.1, HTTP/2, and HTTP/3
HTTP runs inside that encrypted channel: a request consists of a method (GET, HEAD, POST), a path, headers
(Host, Authorization, Content-Type), and an optional body; the reply starts with a three-digit status code:
2xx— success (200 OK,204 No Content).3xx— redirect (301/308permanent,302/307temporary with the target inLocation,304 Not Modifiedto reuse cache).4xx— client or routing error (400malformed request,401unauthenticated,403forbidden,404route not found,429rate limit hit).5xx— server failure (500application error,502backend unreachable from proxy,503service overloaded,504backend timeout).
Methods and status codes mean the same thing across every HTTP version — what changes is how data is framed on the transport layer:
| Version | Transport | Framing | Multiplexing per connection | Key difference |
|---|---|---|---|---|
| HTTP/1.1 | TCP | Plain text | Sequential (browsers open up to 6 TCP connections per host) | Still the standard between a reverse proxy and a local backend |
| HTTP/2 | TCP + TLS (ALPN h2) |
Binary frames | Dozens of streams in one TCP connection, HPACK header compression | Losing one TCP packet stalls every stream on the connection |
| HTTP/3 | UDP + QUIC (UDP and QUIC) | Binary frames | Independent QUIC streams, QPACK compression | No cross-stream head-of-line blocking; survives Wi-Fi / LTE switches |
If it doesn’t work
curl https://example.org fails with SSL: no alternative certificate subject name matches target host name
- Cause
- The server presented a certificate for another domain (or its default fallback cert): the requested domain is missing from the certificate's SAN field, or the reverse proxy has no route matching that SNI.
- Fix
- Inspect the exact certificate returned by the server:
openssl s_client -connect 203.0.113.10:443 -servername example.org </dev/null 2>/dev/null | openssl x509 -noout -subject -ext subjectAltName.
A site loads cleanly in browsers, while curl, Python, or Go fail with unable to get local issuer certificate
- Cause
- The web server sends only the leaf certificate (
cert.pem) without the intermediate (chain.pem). Browsers fetch missing intermediates on their own, while CLI tools and libraries require the full chain. - Fix
- Point nginx or Traefik to the full chain file (
fullchain.pem) and check the output ofopenssl s_client -showcerts -connect example.org:443 -servername example.org </dev/null.
The certificate validates on another machine, yet curl on this server reports certificate is not yet valid or certificate has expired
- Cause
- Either the certificate expired (broken ACME/Let's Encrypt renewal) or the local system clock has drifted.
- Fix
- Check the system clock (
timedatectl) and the certificate validity dates (openssl x509 -noout -dates). If expired, check renewal logs in Traefik or certbot.
https://example.org loads fine, while https://203.0.113.10 returns 404 and a certificate warning
- Cause
- Multiple sites share one IP behind a reverse proxy: routing and certificate selection depend on the domain name in
SNIand theHostheader, which do not match any rule when you connect by raw IP. - Fix
- To test a specific IP without touching DNS, pass the hostname explicitly:
curl -vI --resolve example.org:443:203.0.113.10 https://example.org.
The TLS handshake succeeds, but the server responds with HTTP/2 502 or 504
- Cause
- The client connected to the reverse proxy (nginx, Traefik, Cloudflare), while the backend behind it is down (
502 Bad Gateway) or missed its timeout (504 Gateway Timeout). - Fix
- Debug behind the proxy: check the backend container or service (
docker ps,ss -tulnp) and the proxy logs (Traefik).