Example Request & Response
GET /hello.txt HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0
Accept-Language: en, nl
HTTP/1.1 200 OK
Date: Mon, 27 Jul 2020 12:28:53 GMT
Server: Apache/2.2.22
Content-Length: 12
Content-Type: text/plain
Hello World!
Methods
| Method |
Description |
| GET (safe, idempotent) |
Transfer a current representation of the resource |
| HEAD (safe, idempotent) |
Same as GET, but without transferring content |
| POST |
Process the content of the request |
| PUT (idempotent) |
Update the resource with the content of the request |
| DELETE (idempotent) |
Remove all current representations of the resource |
| CONNECT |
Establish a tunnel to the server |
| OPTIONS (safe, idempotent) |
Describe the communication options for the target resource |
| TRACE (safe, idempotent) |
Perform a message loop-back test along the path to the resource |
"Safe" methods are read-only and should not change the server state.
"Idempotent" methods can be called multiple times without different outcomes.
See RFC 9110 for detailed information about each method.
| Header |
Description |
Referer: <url> |
The referring web page URL |
User-Agent: <ua> |
Information about the client making the request |
Authorization: <scheme> <params> |
Authenticate using the specified scheme and credentials |
Accept: <media-types> |
The media types that the client can understand |
Accept-Encoding: <algorithms> |
The encoding algorithms the client understands |
Accept-Language: <langs> |
The languages that the client can understand |
| Header |
Description |
Location: <url> |
The URL of the new resource or redirect target |
Allow: <methods> |
The methods supported by the resource |
Server: <name> |
Information about the server software |
Retry-After: <s> |
Time to wait before a new request |
Age: <s> |
The age of the cached response (in sec) |
Cache-Control: <directives> |
Directives for caching mechanisms |
Expires: <date> |
Date/time after which the response expires |
See RFC 9111 for detailed information about caching.
Status Codes
A detailed list of status codes can be found in RFC 9110.
| Code |
Description |
| 100 Continue |
The server has received the request headers and the client should proceed |
| 101 Switching Protocols |
The server will switch protocols to those defined by the response's Upgrade header field |
Status Codes: Success
| Code |
Description |
| 200 OK |
The request has succeeded |
| 201 Created |
A new resource has been created |
| 202 Accepted |
The request was accepted but processing has not been completed |
| 203 Non-Authoritative Information |
The response content has been modified by a proxy |
| 204 No Content |
The request was fulfilled but no content is returned |
| 205 Reset Content |
Request fulfilled; the user agent should reset the view |
| 206 Partial Content |
The server has fulfilled a partial GET request |
Status Codes: Redirection
| Code |
Description |
| 300 Multiple Choices |
The requested resource corresponds to any one of a set of representations |
| 301 Moved Permanently |
The requested resource has been assigned a new permanent URI |
| 302 Found |
The requested resource resides temporarily under a different URI |
| 303 See Other |
A different resource can provide an indirect reponse |
Status Codes: Redirection (cont.)
| Code |
Description |
| 304 Not Modified |
The resource has not been modified since the last request |
| 307 Temporary Redirect |
Temporary redirect; client must not change the request method |
| 308 Permanent Redirect |
Permanent redirect; client must not change the request method |
Status Codes: Client Error
| Code |
Description |
| 400 Bad Request |
The server cannot / will not process the request due to a client error |
| 401 Unauthorized |
The request requires user authentication |
| 403 Forbidden |
The server understood but refuses the request |
| 404 Not Found |
No resource was found for the request URI |
| 405 Method Not Allowed |
The method is not allowed for the resource |
| 406 Not Acceptable |
No representation matches the Accept-* headers |
| 407 Proxy Authentication Required |
The client must authenticate with the proxy server |
| 408 Request Timeout |
The server timed out waiting for the request |
| 409 Conflict |
The request conflicts with the current resource state |
| 410 Gone |
The requested resource is permanently unavailable |
| 411 Length Required |
The server requires a Content-Length header |
| 412 Precondition Failed |
One or more conditions evaluated to false |
| 413 Content Too Large |
The request content is too large |
| 414 URI Too Long |
The target URI was too long |
Status Codes: Client Error (cont.)
| Code |
Description |
| 415 Unsupported Media Type |
The requested media type is not supported |
| 416 Range Not Satisfiable |
The request Range header is not satisfiable |
| 417 Expectation Failed |
The server cannot meet the Expect header |
| 421 Misdirected Request |
The request was directed at a server that is not able to produce a response for this request |
| 422 Unprocessable Content |
The server understands the content type but cannot process the content |
| 426 Upgrade Required |
The client should switch to a different protocol |
Status Codes: Server Error
| Code |
Description |
| 500 Internal Server Error |
The server encountered an unexpected error |
| 501 Not Implemented |
The server does not support the functionality required to fulfill the request |
| 502 Bad Gateway |
The upstream server returned an invalid response |
| 503 Service Unavailable |
The server is currently unable to handle the request |
| 504 Gateway Timeout |
The upstream server did not respond in time |
| 505 HTTP Version Not Supported |
The server does not support the HTTP version |