Web Communication in System Architecture
basic · System Architecture
Web Communication & Security Protocols For distributed nodes and client devices to understand each other, they must communicate using a shared, standardized language at the application layer. This layer governs how data payloads are structured, how traffic is securely encrypted over public fiber lines, and how a server separates different incoming network services. 1. The Fabric of the Web: HTTP (Hypertext Transfer Protocol) HTTP is an application-layer protocol that serves as the foundation for data exchange on the internet. It operates on a simple, stateless Request-Response cycle over a TCP/IP connection. THE HTTP REQUEST-RESPONSE CYCLE CLIENT (Browser) SERVER (Backend) ┌──────────────────────┐ ┌──────────────────────┐ │ Generates Request │ ─────────────────────────────────► │ Parses Payload │ │ (Method, URI, Header)│ │ Executes Logic │ └──────────────────────┘ └──────┬───────────────┘ ▲ │ │ ▼ ┌──────────┴───────────┐ ┌──────────────────────┐ │ Renders Interface │ ◄───────────────────────────────── │ Dispatches Response │ │ (HTML/JSON/Assets) │ │ (Status Code, Body) │ └──────────────────────┘ └──────────────────────┘ A. Anatomy of an HTTP Request An application backend or web browser packages an HTTP request using three core structural blocks: HTTP Method (Verb): Defines the exact action the client wants to perform: GET : Fetch an existing resource. POST : Create a brand-new resource or submit data safely. PUT : Replace an entire target resource with an updated payload. DELETE : Permanently erase a resource. Headers: Metadata pairs that provide background context about the request (e.g., Content-Type: application/json or Authorization: Bearer <token> ). Body: The actual payload or data container (typically formatted as JSON or XML) sent to the server during POST or PUT operations. B. Anatomy of an HTTP Response Once processing finishes, the server returns an HTTP response containing a payload along with a standardized HTTP Status Code indicating the outcome of the request: 1xx (Informational): The request was received, and processing is continuing. 2xx (Success): The action was successfully received, understood, and accepted (e.g., 200 OK , 201 Created ). 3xx (Redirection): Further action must be taken by the client to complete the request (e.g., 301 Moved Permanently ). 4xx (Client Error): The request contains bad syntax or cannot be fulfilled due to a client fault (e.g., 400 Bad Request , 401 Unauthorized , 404 Not Found ). 5xx (Server Error): The server failed to fulfill an apparently valid request due to an internal crash (e.g., 500 Internal Server Error , 502 Bad Gateway ). 2. Hardening Data Transit: HTTPS & SSL/TLS Standard HTTP communicates completely in plain text . If a user submits sensitive information (like passwords or credit card numbers) over raw HTTP, anyone sitting on an intermediate network router or public Wi-Fi access point can easily read that data using simple packet-sniffing tools. HTTPS (Hypertext Transfer Protocol Secure) completely neutralizes this risk. It wraps standard HTTP traffic inside a secure, cryptographically encrypted tunnel using the SSL/TLS (Secure Sockets Layer / Transport Layer Security) protocol. The SSL/TLS Handshake Pipeline Before an HTTPS session can transmit a single byte of application data, the client and server run a secure cryptographic handshake protocol to verify identities and agree on encryption variables: THE SSL/TLS HANDSHAKE STEPS CLIENT SERVER ┌──────────────┐ ┌──────────────┐ │ ClientHello │ ─────────────────────────────────────────► │ Receives Hello│ │(Cipher Options)│ └──────┬───────┘ └──────────────┘ │ ▲ ▼ │ ┌──────────────┐ └─────────────────────────────────────────────────── │ ServerHello │ │ & SSL Cert │ ┌──────────────┐ └──────────────┘ │Verify Cert & │ ▲ │Generate Key │ ──────────────────────────────────────────────────┘ └──────┬───────┘ │ ▼ [Asymmetric Handshake Closes -> Symmetric Data Tunnel Is Open] ClientHello: The client kicks off the handshake by sending its supported cryptographic algorithms (Cipher Suites) and its TLS version to the server. ServerHello & Certificate: The server responds with its chosen Cipher Suite along with its SSL Certificate , which contains the server's verifiable public key. This certificate is cryptographically signed by a trusted global third party called a Certificate Authority (CA). Authentication: The client checks the certificate against its built-in list of trusted CAs to ensure the server is legitimate and hasn't been spoofed by an attacker. Key Exchange: The client generates a random Symmetric Session Key , encrypts it using the server's verified public key, and sends it to the server. The server uses its matching private key to decrypt the message and extract the session key. Secure Tunnel Activated: Now, both the client and server share the exact same symmetric session key. The slow asymmetric handshake finishes, and all subsequent HTTP data traffic is encrypted using fast Symmetric Encryption , rendering intercepted packets unreadable to external eavesdroppers. 3. Infrastructure Traffic Routing: Ports A production server doesn't just run one single service. It might run a web server backend, a relational database instance, and an SSH terminal connection simultaneously. When a data packet arrives at the server's network interface card via its IP address, the server needs a way to route that packet to the correct application software thread. A Port is a logical communication endpoint identifier (expressed as a number between 1 and 65535 ) used to route network traffic directly to a specific software service running inside an operating system. Standard Networking Port Assignments To keep web systems orderly, the Internet Assigned Numbers Authority (IANA) reserves specific, well-known ports for standard network protocols: Reserved Port Standard Protocol Assignment Primary Traffic Profile Context 22 SSH (Secure Shell) Safe command-line terminal access to remote servers. 53 DNS (Domain Name System) Handling domain-to-IP resolution requests (primarily using UDP). 80 HTTP Standard, unencrypted web traffic routing. 443 HTTPS Secured, TLS-encrypted web traffic routing. 5432 PostgreSQL Standard incoming database connection traffic. 6379 Redis High-performance in-memory caching connection layer. Web Communications Reference Matrix Protocol / Identifier Vector Operational Network OSI Layer Core Engineering Mandate Primary Production Vulnerability Exposure HTTP Layer 7 (Application) Structures request-response communication semantics cleanly. Completely vulnerable to Man-In-The-Middle (MITM) data eavesdropping. HTTPS (with TLS) Layer 7 / Layer 4 Enforces absolute end-to-end data encryption and server identity verification. Weak cipher suite setups or outdated TLS versions can open doors to downgrade attacks. Port Mapping Layer 4 (Transport) Dispatches incoming network packets to the correct application software container. Leaving unnecessary database or terminal ports exposed to the public internet invites automated brute-force hacking attempts.