Networking doesn't stop at IP addresses, DNS, and ports.
Once a client successfully reaches a server, several other technologies come into play:
- HTTP and HTTPS enable communication between clients and servers
- Load balancers distribute traffic across multiple servers
- Firewalls control who is allowed to access services
These concepts form the foundation of modern web applications, cloud infrastructure, Kubernetes environments, and production systems.
In this article, we'll explore:
- What HTTP is and how it works
- Common HTTP methods and status codes
- How HTTPS secures communication
- Why load balancers are essential
- How firewalls protect infrastructure
- Essential UFW commands for Linux servers
What Is HTTP?
HTTP (HyperText Transfer Protocol) is the communication protocol used by web browsers and servers.
It follows a simple request-response model:
- A client sends a request.
- The server processes the request.
- The server returns a response.
HTTP is stateless, meaning every request is independent and the server doesn't automatically remember previous requests.
Anatomy of an HTTP Request
Example request:
GET /search?q=devops HTTP/1.1
Host: www.google.com
User-Agent: curl/8.1.2
Accept: text/html
An HTTP request consists of:
| Component | Purpose |
|---|---|
| Method | Action to perform |
| Path | Resource being requested |
| Version | HTTP protocol version |
| Headers | Metadata about the request |
| Body | Optional request data |
Anatomy of an HTTP Response
Example response:
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 15258
Server: nginx
Response components:
| Component | Purpose |
|---|---|
| Status Line | Status code and message |
| Headers | Metadata about the response |
| Body | Actual content returned |
Common HTTP Methods
Different methods tell the server what action to perform.
| Method | Purpose | Example |
|---|---|---|
| GET | Retrieve data | Load a webpage |
| POST | Create new data | Submit a form |
| PUT | Replace a resource | Update a profile |
| PATCH | Modify part of a resource | Update an email address |
| DELETE | Remove a resource | Delete an account |
Understanding HTTP Status Codes
Status codes tell us the result of a request.
Status Code Categories
| Range | Category |
|---|---|
| 1xx | Informational |
| 2xx | Success |
| 3xx | Redirection |
| 4xx | Client Errors |
| 5xx | Server Errors |
Common Status Codes Every DevOps Engineer Should Know
| Code | Meaning |
|---|---|
| 200 | OK |
| 201 | Created |
| 301 | Permanent Redirect |
| 302 | Temporary Redirect |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 429 | Too Many Requests |
| 500 | Internal Server Error |
| 502 | Bad Gateway |
| 503 | Service Unavailable |
| 504 | Gateway Timeout |
Why 502, 503, and 504 Matter
These errors often indicate infrastructure issues rather than application bugs.
502 Bad Gateway
A proxy or load balancer received an invalid response from the backend service.
Common cause:
- Backend application crashed
- Service isn't running
503 Service Unavailable
The server is temporarily unable to handle requests.
Common cause:
- Maintenance
- Resource exhaustion
- Overloaded server
504 Gateway Timeout
The backend service took too long to respond.
Common cause:
- Slow database queries
- Hung application processes
- Network latency
These are among the most common production issues DevOps engineers troubleshoot.
What Is HTTPS?
HTTPS is HTTP running over TLS (Transport Layer Security).
The communication model remains exactly the same, but all data is encrypted before being transmitted.
Without HTTPS, attackers could potentially view:
- Passwords
- Cookies
- API tokens
- Personal information
HTTPS protects data while it's traveling across networks.
How TLS Works
A simplified TLS handshake looks like this:
Step 1: Client Hello
The client initiates a secure connection request.
Step 2: Server Certificate
The server provides a digital certificate proving its identity.
Step 3: Certificate Validation
The client verifies:
- Certificate validity
- Domain ownership
- Trusted Certificate Authority (CA)
Step 4: Key Exchange
Client and server securely establish a shared encryption key.
Step 5: Encrypted Communication
All subsequent HTTP traffic becomes encrypted.
What Is an SSL/TLS Certificate?
A certificate binds:
- A domain name
- A public key
The certificate is digitally signed by a trusted Certificate Authority (CA).
Popular providers include:
- Let's Encrypt
- DigiCert
- Sectigo
Without a valid certificate, browsers display security warnings.
What Is a Load Balancer?
A load balancer sits between clients and backend servers.
Instead of sending all traffic to a single server, it distributes requests across multiple servers.
ββββββββββββββββ
Clients βββββββββΊ β Load Balancerβ
ββββββββ¬ββββββββ
β
βββββββββββββββββΌββββββββββββββββ
βΌ βΌ βΌ
Server 1 Server 2 Server 3
Why Load Balancers Are Important
Scalability
Traffic is distributed across multiple servers.
High Availability
Failed servers are automatically removed from rotation.
Zero-Downtime Deployments
Applications can be updated one server at a time without affecting users.
Common Load Balancing Algorithms
Round Robin
Requests are distributed evenly in sequence.
Request 1 β Server 1
Request 2 β Server 2
Request 3 β Server 3
Least Connections
Traffic goes to the server with the fewest active connections.
Useful when workloads vary significantly.
IP Hash
Traffic is routed based on the client's IP address.
Useful for session persistence.
What Is a Firewall?
A firewall controls incoming and outgoing network traffic using predefined rules.
Its purpose is to:
- Allow legitimate traffic
- Block unwanted traffic
- Reduce attack surfaces
Firewalls can filter traffic based on:
- Ports
- Protocols
- Source IP addresses
- Destination IP addresses
The Default-Deny Security Principle
A strong security practice is:
Block Everything
β
Allow Only What Is Needed
This approach minimizes exposure and reduces risk.
Managing Firewalls with UFW
Ubuntu provides a user-friendly firewall tool called UFW (Uncomplicated Firewall).
Check Firewall Status
sudo ufw status
Enable Firewall
sudo ufw enable
Disable Firewall
sudo ufw disable
Set Default Policies
sudo ufw default deny incoming
sudo ufw default allow outgoing
Allow Essential Services
Allow SSH
sudo ufw allow 22/tcp
Allow HTTP
sudo ufw allow 80/tcp
Allow HTTPS
sudo ufw allow 443/tcp
Allow a Specific IP Address
sudo ufw allow from 203.0.113.5
Remove a Firewall Rule
sudo ufw delete allow 80/tcp
View Detailed Firewall Rules
sudo ufw status verbose
Important Warning Before Enabling UFW
If you're connected via SSH, always allow port 22 before enabling the firewall.
Correct sequence:
sudo ufw allow 22/tcp
sudo ufw enable
Failing to do this can lock you out of your server.
Security Groups vs UFW
Cloud servers often have two firewall layers:
Cloud Security Groups
Examples:
- AWS Security Groups
- Azure NSGs
- GCP Firewall Rules
These operate outside the virtual machine.
UFW / iptables
These operate inside the Linux operating system.
Using both provides stronger protection through defense in depth.
Bringing It All Together
When you visit a secure website:
- DNS resolves the domain name.
- Your browser connects to the server's IP.
- Traffic is sent through port 443.
- TLS encrypts the connection.
- An HTTP request is sent.
- A load balancer may distribute the request.
- A backend server processes it.
- Firewalls ensure only allowed traffic reaches the service.
- The server returns an HTTP response.
Understanding this flow is essential for anyone working in DevOps, Cloud Engineering, Site Reliability Engineering, or System Administration.
The deeper you understand networking fundamentals, the easier it becomes to troubleshoot real-world production systems.
Happy Learning! π
Top comments (0)