Lesson 07 of 16 · HTTPS and certificates
From HTTP to HTTPS
What changes when a site moves from HTTP to HTTPS: what an observer can and cannot see, what TLS adds (encryption, integrity, server identity), the handshake in plain words, why 'SSL' is the old name, what the padlock does not promise, and the server settings every HTTPS site should have: redirect, HSTS, modern TLS versions.
HTTP sends everything in the clear
With plain HTTP, every router, Wi-Fi hotspot and ISP between you and the server can read and change the traffic: passwords in forms, session cookies, the pages themselves. Attackers on public Wi-Fi have used this to steal sessions, and some networks have injected adverts into pages.
What HTTPS adds
HTTPS is HTTP inside a TLS connection (port 443). TLS gives three things:
| Property | Means | Building block (lesson 3) |
|---|---|---|
| Confidentiality | Nobody in between can read it | Key exchange + symmetric encryption |
| Integrity | Nobody can change it unnoticed | Authenticated encryption |
| Server authentication | You're talking to the real owner of the domain | Certificate + signature |
SSL is the old name. All SSL versions and TLS 1.0/1.1 are broken or deprecated; today you use TLS 1.2 and 1.3. People still say "SSL certificate", which just means a TLS certificate.
HTTP is sending a postcard: every postman can read it and could even change it. HTTPS is a locked box that only you and the real shop can open, and the shop shows an ID card signed by a trusted office (the certificate) before you hand it anything.
The handshake, in plain words
Browser Server
│── "Hello. I can do TLS 1.3/1.2, these ciphers, │
│ I want site shop.example.com (SNI), here's my │
│ key-exchange value" ─────────────────────────────── ►│
│◄─ "Hello. We'll use TLS 1.3 + AES-GCM; here's my │
│ key-exchange value" ──────────────────────────────── │
│ (both now compute the same secret → encryption on) │
│◄─ certificate for shop.example.com + intermediate ──── │
│◄─ signature proving I hold the private key ─────────── │
│ browser checks: trusted CA? name matches? not │
│ expired? signature valid? │
│══ encrypted HTTP: GET /cart, cookies, form data ═══════│
The browser's checks are the subject of the next lessons: name (lesson 8), trusted issuer (lesson 9), dates (lesson 12).
What HTTPS does not hide or promise
- Visible: the server's IP address, usually the hostname (through DNS and SNI), when you connected and how much data moved.
- Hidden: the full URL path and query, the pages, form data, cookies and headers.
- Not promised: that the site is honest. A padlock means "encrypted to whoever controls this domain". Phishing sites get valid certificates too. Check the domain name, not just the padlock.
- Not protected: data once it reaches the server (that needs server security), or a compromised laptop.
Every HTTPS site should have
- Redirect HTTP to HTTPS (a 301 from port 80 to 443).
- HSTS so browsers never try HTTP again:
Strict-Transport-Security: max-age=31536000; includeSubDomains
- TLS 1.2 and 1.3 only; older versions off.
- Automatic certificate renewal (lesson 11) and expiry monitoring (lesson 12).
- No mixed content: an HTTPS page loading scripts or images over HTTP undoes the protection; browsers block or warn.
A minimal nginx example:
server {
listen 80;
server_name shop.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
http2 on;
server_name shop.example.com;
ssl_certificate /etc/letsencrypt/live/shop.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/shop.example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
}
Try it
Run curl -vI https://example.com 2>&1 | grep -E "SSL connection|subject:|issuer:|expire date" to see the TLS version, the certificate's name, who issued it and when it expires.
Recap
- HTTP can be read and changed by anyone in between; HTTPS adds confidentiality, integrity and server authentication.
- "SSL" is the old name; use TLS 1.2/1.3.
- The padlock means encrypted to the domain's owner, not trustworthy; hostnames and IPs are still visible.
- Redirect to HTTPS, set HSTS, modern TLS only, automate renewal, avoid mixed content.
This site is a public version of my personal engineering knowledge hub. It intentionally excludes confidential company information and internal operational details.