Listen to this Post
2025-01-31
HTTP status codes are essential for web developers, IT professionals, and cybersecurity experts. They indicate the response status of an HTTP request between a client and a server. Hereβs a breakdown of the most common HTTP status codes:
1xx β Informational
- 100 Continue β The server has received the request headers and expects the client to proceed.
- 101 Switching Protocols β The server is switching protocols as requested by the client.
- 102 Processing β The server has received and is processing the request but has not yet completed it.
2xx β Success
- 200 OK β The request was successful, and the server responded with the requested content.
- 201 Created β A new resource has been successfully created.
- 202 Accepted β The request has been accepted but is still being processed.
- 204 No Content β The request was successful, but there is no content to return.
3xx β Redirection
- 301 Moved Permanently β The requested resource has been permanently moved to a new URL.
- 302 Found β The requested resource is temporarily available at a different URL.
- 304 Not Modified β The requested resource has not changed since the last request.
4xx β Client Errors
- 400 Bad Request β The server could not understand the request due to invalid syntax.
- 401 Unauthorized β Authentication is required to access the requested resource.
- 403 Forbidden β The server refuses to authorize the request.
- 404 Not Found β The requested resource could not be found.
- 408 Request Timeout β The server timed out waiting for the request.
5xx β Server Errors
- 500 Internal Server Error β A generic server error occurred.
- 502 Bad Gateway β The server received an invalid response from an upstream server.
- 503 Service Unavailable β The server is temporarily unable to handle the request.
- 504 Gateway Timeout β The server did not receive a timely response from an upstream server.
What Undercode Say
Understanding HTTP status codes is crucial for troubleshooting web applications, improving security, and optimizing network performance. Here are some useful Linux commands to debug and analyze HTTP status codes:
Check HTTP Status of a URL
curl -I https://example.com
This command returns only the HTTP headers, including the status code.
Verbose cURL Request
curl -v https://example.com
This provides detailed information about the request and response.
Using wget
to Check Response
wget --server-response --spider https://example.com
This command retrieves the headers without downloading the content.
Check Logs for Status Codes (Apache & Nginx)
For Apache:
tail -f /var/log/apache2/access.log
For Nginx:
tail -f /var/log/nginx/access.log
Filter Logs by HTTP Status Code
grep 404 /var/log/apache2/access.log
This command helps you find all occurrences of a 404 Not Found error in the logs.
Test Website Availability with httping
httping -g https://example.com
This tool continuously pings a website to check for its availability.
Monitor Live Requests with tcpdump
sudo tcpdump -i eth0 port 80 or port 443
This command captures HTTP and HTTPS traffic to analyze status codes in real-time.
Β Useful resources
- Full HTTP status code list: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
- cURL Documentation: https://curl.se/docs/
By mastering HTTP status codes and related troubleshooting commands, IT professionals and cybersecurity experts can diagnose issues faster and ensure a seamless web experience.
References:
Hackers Feeds, Undercode AI