HTTP: The Basics Behind Every Web Request
HTTP (Hyper Text Transfer Protocol) is the backbone of the web, defining how clients request data from servers and how servers respond. As an application layer protocol, HTTP relies on TCP to ensure every bit of data reaches its destination. It's also a stateless protocol, meaning servers don't store client data by default.
For enhanced security, there's HTTPS, which combines HTTP with SSL (Secure Socket Layer) to encrypt data transfers.
HTTP methods are the tools for performing CRUD operations (Create, Read, Update, Delete):
GET - Retrieve data.
PUT - Update data.
POST - Create new data.
DELETE - Remove data.
HTTP Status Codes are the web's way of communicating the outcome of your requests. When your browser asks a server for a webpage, the server responds with a status code indicating success or failure.
Common HTTP status code classes:
1XX - Informational.
2XX - Success.
3XX - Redirection.
4XX - Client-side Error.
5XX - Server-side Error.
Detailed HTTP Status Codes:
1XX - Informational
100 (Continue) - Server received the request header; client should proceed with the request body.
101 (Switching Protocols) - Server agrees to switch protocols as requested.
102 (Processing WebDAV) - Server is processing the request but hasn't completed it yet.
103 (Early Hints) - Provides early hints for preloading resources.
2XX - Success
200 (OK) - Request succeeded.
201 (Created) - Request accepted; resource created.
203 (No Content) - Request successful, but no content to return.
204 (Accepted) - Request accepted, but the resource is from a non-primary source.
206 (Partial Content) - Partial resource sent, useful for byte-serving.
3XX - Redirection
301 (Moved Permanently) - Resource permanently moved.
302 (Found) - Resource temporarily moved.
303 (See Other) - Redirect to a different resource, often after a POST operation.
304 (Not Modified) - Resource unchanged since the last request, aiding in caching.
4XX - Client-side Errors
400 (Bad Request) - Request cannot be processed.
401 (Unauthorized) - Authentication required.
403 (Forbidden) - Client authenticated but lacks permission.
404 (Not Found) - Resource not found.
405 (Method Not Allowed) - HTTP method not allowed for the resource.
406 (Not Acceptable) - Server can't produce a response matching the client's request headers.
409 (Conflict) - Request conflicts with the current server state.
413 (Payload Too Large) - Request body too large for the server to process.
429 (Too Many Requests) - Client made too many requests in a given time frame.
5XX - Server-side Errors
500 (Internal Server Error) - Generic server-side error.
502 (Bad Gateway) - Invalid response from an upstream server.
503 (Service Unavailable) - Server temporarily unable to handle the request.
504 (Gateway Timeout) - Upstream server didn't respond in time.
Subscribe to my newsletter
Read articles from Anirban Banerjee directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by