🌐
HTTP & Network Cheatsheet
HTTP status codes (2xx–5xx), common headers, CORS overview.
2xx — Success
| Code | Name | Description |
|---|---|---|
| 200 | OK | Standard success. GET, POST, PUT responses. |
| 201 | Created | Resource created. Typically after POST. |
| 202 | Accepted | Request accepted but not yet processed. |
| 204 | No Content | Success with no response body. DELETE, PUT. |
| 206 | Partial Content | Range request fulfilled (streaming, downloads). |
3xx — Redirects
| Code | Name | Description |
|---|---|---|
| 301 | Moved Permanently | Permanent redirect. Browsers cache. |
| 302 | Found | Temporary redirect. Method may change to GET. |
| 304 | Not Modified | Resource unchanged. Use cached version. |
| 307 | Temporary Redirect | Temporary. Method preserved (POST stays POST). |
| 308 | Permanent Redirect | Permanent. Method preserved. |
4xx — Client Errors
| Code | Name | Description |
|---|---|---|
| 400 | Bad Request | Malformed request syntax or invalid parameters. |
| 401 | Unauthorized | Authentication required (not "unauthorized"). |
| 403 | Forbidden | Authenticated but lacks permission. |
| 404 | Not Found | Resource does not exist. |
| 405 | Method Not Allowed | HTTP method not supported for this endpoint. |
| 409 | Conflict | State conflict — e.g. duplicate resource. |
| 410 | Gone | Resource permanently deleted. |
| 422 | Unprocessable Entity | Validation errors on well-formed request. |
| 429 | Too Many Requests | Rate limit exceeded. |
5xx — Server Errors
| Code | Name | Description |
|---|---|---|
| 500 | Internal Server Error | Generic unhandled server error. |
| 501 | Not Implemented | Method not supported by the server. |
| 502 | Bad Gateway | Upstream server sent an invalid response. |
| 503 | Service Unavailable | Server overloaded or in maintenance. |
| 504 | Gateway Timeout | Upstream server did not respond in time. |
Common HTTP Headers
| Header | Direction | Purpose |
|---|---|---|
| Authorization | Request | Credentials: Bearer {token}, Basic {b64} |
| Content-Type | Both | MIME type: application/json, text/html |
| Accept | Request | Acceptable response MIME types |
| Cache-Control | Both | Caching directives: no-cache, max-age=3600 |
| ETag | Response | Resource version identifier for conditional requests |
| Location | Response | URL for redirects or newly created resources |
| X-Request-Id | Both | Correlation ID for tracing |
| CORS: Access-Control-Allow-Origin | Response | Allowed request origins: *, https://example.com |