HTTP Response

After it has received a request, validated and processed it, and has its thoughts together, the server is ready to send its response.

The only mandatory parts of the response are the HTTP version, the status code, and the status message.

HTTP/1.1 200 OK

Or a multitude of other valid status messages, such as:

HTTP/1.1 404 Not Found

(More information on status codes can be found here)

The HTTP response typically contains a lot more information.

An example of a successful request:

HTTP/1.1 200 OK
Cookie: new=cookie%20data
X-Robots-Tag: nofollow
Connection: Close

<html><head><title>HTML page is transferred in the payload</title>

The user is being redirected

HTTP/1.1 302 Found
Location: http://www.example.com/new-url
Connection: Close

The page could not be found

HTTP/1.1 404 Not Found
Connection: Close

<html><head><title>A custom 404 page should be sent in the payload</title>