0
0
HLDsystem_design~7 mins

HTTP and HTTPS in HLD - System Design Guide

Choose your learning style9 modes available
Problem Statement
When data is sent over the internet without encryption, attackers can intercept and read sensitive information like passwords or credit card numbers. This leads to privacy breaches, data theft, and loss of user trust.
Solution
HTTPS solves this by encrypting data between the user's browser and the server using SSL/TLS protocols. This encryption ensures that even if data is intercepted, it cannot be read or tampered with, protecting user privacy and data integrity.
Architecture
┌───────────────┐           ┌───────────────┐
│   User's      │           │   Web Server  │
│   Browser     │           │               │
└──────┬────────┘           └──────┬────────┘
       │ HTTPS Request (Encrypted)    │
       │─────────────────────────────▶│
       │                             │
       │ HTTPS Response (Encrypted)  │
       │◀────────────────────────────│

This diagram shows encrypted communication between the user's browser and the web server using HTTPS, protecting data in transit.

Trade-offs
✓ Pros
Encrypts data to prevent eavesdropping and tampering.
Builds user trust by showing secure connection indicators in browsers.
Supports authentication of the server to prevent impersonation.
Improves SEO rankings as search engines prefer secure sites.
✗ Cons
Requires obtaining and managing SSL/TLS certificates, adding operational overhead.
Slightly increases latency due to encryption and decryption processes.
Needs proper configuration to avoid vulnerabilities like weak ciphers or misconfigured certificates.
Always use HTTPS for any website or API that handles sensitive data or user interactions, especially when traffic exceeds hundreds of requests per second or involves personal information.
Avoid using plain HTTP for any public-facing service; HTTP may be acceptable only for internal, isolated networks where encryption is handled separately.
Real World Examples
Amazon
Uses HTTPS to secure customer login, payment processing, and personal data transmission to prevent theft and fraud.
Google
Enforces HTTPS across all its services to protect user data and improve privacy on search, Gmail, and cloud services.
Netflix
Uses HTTPS to secure streaming sessions and user account information, ensuring content protection and privacy.
Alternatives
HTTP with VPN
Encrypts all network traffic at the network layer rather than just web traffic.
Use when: Use when securing all types of network traffic beyond HTTP, especially in corporate environments.
HTTP/2 with TLS
An improved version of HTTP that requires TLS encryption by design and offers better performance.
Use when: Use when you want both encryption and faster web communication with multiplexing and header compression.
Summary
HTTP sends data in plain text, making it vulnerable to interception and tampering.
HTTPS encrypts data using SSL/TLS, protecting privacy and ensuring data integrity.
Modern web services should always use HTTPS to secure user interactions and build trust.