# HTTPS and TLS

> Encrypt traffic with TLS, obtain certificates automatically and understand what the handshake proves. Free notes, key concepts, resources and a mini project.

Canonical: https://www.internhack.in/roadmaps/tracks/backend/tls-https
Last updated: 2026-11-28

Encrypt traffic with TLS, obtain certificates automatically and understand what the handshake proves.

Beginner · about 3 hours · difficulty 2/5

Learn first: [HTTP in Depth](https://www.internhack.in/roadmaps/tracks/backend/http-protocol), [Where Backends Run: Hosting Options](https://www.internhack.in/roadmaps/tracks/backend/hosting-basics)

**TLS** (Transport Layer Security) encrypts traffic between client and server and proves the server's identity. **HTTPS** is simply HTTP over TLS. Every public backend must use it; browsers mark plain HTTP as insecure and many features require HTTPS.

### What TLS gives you

- **Confidentiality**: eavesdroppers cannot read the traffic.
- **Integrity**: tampering is detected.
- **Authentication**: the server presents a **certificate** signed by a trusted **Certificate Authority (CA)**, proving it controls the domain.

### How the handshake works (TLS 1.3, simplified)

The client and server agree on a cipher suite and perform a key exchange (ECDHE) to derive shared session keys. The server sends its certificate chain, which the client validates up to a root CA it trusts. Then encrypted application data flows.

### In practice

- Get free, automatically renewed certificates from **Let's Encrypt** via certbot, or let Caddy, your PaaS, load balancer or CDN handle it.
- Terminate TLS at a reverse proxy or load balancer, and decide whether internal hops also need encryption (in zero-trust setups they do, often via **mTLS**).
- Redirect HTTP to HTTPS and add **HSTS** so browsers never try plain HTTP again.
- Disable old protocols (SSL, TLS 1.0 and 1.1).

### Pitfalls

- Expired certificates are a classic outage. Automate renewal and alert on expiry.
- Disabling certificate verification in HTTP clients "to make it work".

You are ready to move on when your deployed app has an A rating on an SSL test tool, auto-renewing certificates and HSTS enabled.

## Key concepts

- **Certificates and certificate authorities**
- **TLS 1.3 handshake**
- **Let's Encrypt and certbot**
- **TLS termination at a proxy**
- **HSTS**
- **Mutual TLS (mTLS)**

## Mini project

Put your VPS-hosted app behind Nginx or Caddy with a Let's Encrypt certificate, HTTP to HTTPS redirect and HSTS, then scan it with an online SSL testing tool.

## Check yourself

What exactly does a valid TLS certificate prove to the browser, and what does it not prove?

## Free resources

- [Let's Encrypt documentation](https://letsencrypt.org/docs/) (Let's Encrypt)
- [MDN: Transport Layer Security](https://developer.mozilla.org/en-US/docs/Web/Security/Transport_Layer_Security) (MDN)
- [What is TLS?](https://www.cloudflare.com/learning/ssl/transport-layer-security-tls/) (Cloudflare)

Previous: [Storing Passwords and Hashing](https://www.internhack.in/roadmaps/tracks/backend/password-hashing) · Next: [CORS, CSP and Security Headers](https://www.internhack.in/roadmaps/tracks/backend/browser-facing-security)

## More in Defending Your Backend

- [Storing Passwords and Hashing](https://www.internhack.in/roadmaps/tracks/backend/password-hashing)
- [HTTPS and TLS](https://www.internhack.in/roadmaps/tracks/backend/tls-https)
- [CORS, CSP and Security Headers](https://www.internhack.in/roadmaps/tracks/backend/browser-facing-security)
- [Common Vulnerabilities: OWASP Top 10](https://www.internhack.in/roadmaps/tracks/backend/owasp-top-ten)
- [Managing Secrets and Configuration](https://www.internhack.in/roadmaps/tracks/backend/secrets-management)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Backend Developer Roadmap](https://www.internhack.in/roadmaps/tracks/backend)
