HTTP Status Codes: Easy Guide

Listen to this Post

Featured Image

1XX: Information

  • 100 Continue: Go ahead, keep sending your request.
  • 101 Switching Protocols: The server is switching to a new way of communicating.
  • 102 Processing: The server is working on your request.
  • 103 Early Hints: The server is giving you tips to load things faster.

2XX: Success

  • 200 OK: Everything worked just fine.
  • 201 Created: Something new was made.
  • 202 Accepted: The server received your request, but is still working on it.
  • 204 No Content: The action worked, but there’s nothing to send back.
  • 206 Partial Content: Only part of what you requested was sent (like a part of a file).

3XX: Redirection

  • 301 Moved Permanently: What you want is now at a new web address.
  • 302 Found: The item is somewhere else for now.
  • 303 See Other: Check somewhere else for the results.
  • 304 Not Modified: Nothing has changed, so use your stored version.
  • 307 Temporary Redirect: The resource moved temporarily; keep using the same method (GET/POST).

4XX: Client Error

  • 400 Bad Request: The server could not understand your request.
  • 401 Unauthorized: You need to log in to see this.
  • 403 Forbidden: You are not allowed to access this.
  • 404 Not Found: What you want does not exist on the server.
  • 405 Method Not Allowed: This kind of request (method) can’t be used here.
  • 406 Not Acceptable: The server can’t provide data in the way you requested.
  • 409 Conflict: Your request conflicts with something that already exists.
  • 413 Payload Too Large: You sent too much data.
  • 429 Too Many Requests: You sent too many requests—slow down.

5XX: Server Error

  • 500 Internal Server Error: The server had a problem.
  • 501 Not Implemented: The server cannot handle your request.
  • 502 Bad Gateway: The server got a bad response from another server.
  • 503 Service Unavailable: The server is down or too busy.
  • 504 Gateway Timeout: Another server took too long to respond.
  • 505 HTTP Version Not Supported: The server doesn’t understand the version of HTTP you are using.

You Should Know:

Testing HTTP Status Codes with cURL

curl -I http://example.com 

This command retrieves HTTP headers, including the status code.

Simulating 404 in Python Flask

from flask import Flask, abort 
app = Flask(<strong>name</strong>)

@app.route('/notfound') 
def notfound(): 
abort(404) 

Checking Redirects (301/302)

curl -L http://example.com/old-url 

The `-L` flag follows redirects.

Rate Limiting Test (429)

for i in {1..100}; do curl -I http://example.com; done 

Flooding a server with requests may trigger a 429 Too Many Requests response.

Forcing HTTP/1.0 (505 Test)

curl --http1.0 http://example.com 

Some servers reject older HTTP versions.

Debugging 500 Errors in Apache

tail -f /var/log/apache2/error.log 

Monitor server logs for internal errors.

Simulating 503 with Nginx

location /maintenance { 
return 503; 
} 

Handling 401 Unauthorized with Basic Auth

curl -u username:password http://protected.example.com 

Checking Cached Responses (304)

curl -H "If-None-Match: \"etag_value\"" http://example.com 

Testing Payload Size (413)

dd if=/dev/zero bs=1M count=100 | curl -X POST --data-binary @- http://example.com/upload 

Sends a 100MB payload to test server limits.

Monitoring 502 Errors

netstat -tulnp | grep nginx 

Check if backend services are running.

What Undercode Say

Understanding HTTP status codes is crucial for debugging web applications. Developers should automate status code checks in CI/CD pipelines using tools like Postman or custom scripts. Monitoring tools (Prometheus, Grafana) should track 5XX errors to detect server failures early.

Useful Linux Commands for Debugging

 Check active HTTP connections 
ss -tuln | grep ':80|:443'

Simulate load testing 
ab -n 1000 -c 100 http://example.com/

Inspect TLS handshake errors 
openssl s_client -connect example.com:443 

Windows Equivalent (PowerShell)

 Test HTTP status 
Invoke-WebRequest -Uri "http://example.com" -Method Get -StatusCodeVariable "Status"

Check port availability 
Test-NetConnection -ComputerName example.com -Port 80 

Prediction

As web applications grow more complex, HTTP/3 and QUIC will reduce latency, but developers must adapt to new status codes and error-handling mechanisms. AI-driven debugging tools will soon auto-diagnose HTTP issues in real time.

Expected Output:

A comprehensive guide on HTTP status codes with practical commands for testing and debugging web applications.

IT/Security Reporter URL:

Reported By: Aaronsimca Http – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 Telegram