Networking and the web
What is HTTPS?
Definition
HTTPS is ordinary HTTP carried inside a TLS-encrypted connection, so requests and responses cannot be read or modified by anyone on the network in between.
Also known as: HTTP Secure, HTTP over TLS
HTTPS in more detail
HTTPS is not a different protocol from HTTP. It is the same requests, methods and status codes, sent through a TLS tunnel established before any HTTP byte moves, conventionally on port 443 rather than 80. The three properties TLS provides are confidentiality (a network observer sees ciphertext), integrity (tampering is detected), and authentication of the server through its certificate.
That last property is what stops the encryption being pointless. When your browser connects, the server presents a certificate signed by a certificate authority the browser already trusts, binding the domain name to a public key. Encryption without that check would happily give you a perfectly private channel to an attacker. This is also why certificate warnings must never be clicked through on a site handling anything sensitive.
HTTPS protects data in transit and nothing else. The site at the other end may still be malicious — a padlock says the connection is private, not that the operator is honest. An observer can also still see which host you connected to, from the DNS lookup and, unless Encrypted Client Hello is in use, the SNI field of the handshake, plus the size and timing of your traffic. Modern deployments add HSTS so browsers refuse to fall back to plaintext.
HTTPS example
http://example.com/login -> plaintext on the wire
https://example.com/login -> TLS-encrypted, port 443
# What a network observer can and cannot see
Can see: the IP address, the hostname (via DNS/SNI),
packet sizes and timing
Cannot see: the path, headers, cookies, form fields,
the response body
# Tell browsers never to use plaintext for this host again
Strict-Transport-Security: max-age=63072000; includeSubDomains; preloadHTTPS — common questions
- Does HTTPS mean a website is safe?
- No. It means the connection to that site is private and the certificate matches the domain. A phishing site can obtain a valid certificate in minutes, so the padlock proves who you are talking to, not whether they deserve trust.
- Is the URL path encrypted with HTTPS?
- Yes. The path, query string, headers and body are all inside the encrypted tunnel. The hostname leaks separately through DNS and the TLS handshake unless Encrypted Client Hello and encrypted DNS are both in use.
- What is the difference between HTTPS and SSL?
- HTTPS is HTTP running over a TLS connection. SSL is the obsolete predecessor of TLS whose name stuck around in marketing, so an 'SSL certificate' today is a TLS certificate. All SSL versions are deprecated and disabled in modern software.
Keep reading
Every definition in the set is indexed A-Z in the developer glossary, and the cheat sheets cover the syntax once you know what you are looking for.
Browse the A-Z glossary