Once DNS is out of the way, and we establish a TCP connect, we have to work with HTTP data. If you’re up to snuff with that, let’s dive in. Think of yourself as a browser. That includes you, Safari.
We have found the IP address of our web server and connected to it via a TCP handshake. Now we’re going to send over some HTTP packets.
- You send over your first actual HTTP message. You send a GET request over port 80.
- The web server sends back an HTTP Response. It shoots back HTTP/1.1 200 OK.
But, what’s that mean? That’s actually what we’re going to cover today. I just wanted us to know how we got here. It is a complicated dance of packets going back and forth across the wire to even arrive at this point, but now we’re here.
What the web server sent back is called an HTTP Response Code. There are five major categories of Response Codes, and each one serves a different purpose.
- 100 Series: Informational
- 200 Series: Success
- 300 Series: Redirection
- 400 Series: Client Error
- 500 Series: Server Error
So, let’s cover what these mean in a bit more detail and go over a few common responses that we will typically see.
Informational HTTP Response Codes
- This means the request has been received and the process can continue.
100 – Continue
- Only part of the request was received, but the client should continue sending further requests.
101 – Switching Protocols
The server is switching protocols. This could be to use a newer HTTP version that is real-time and synchronous.
Success HTTP Response Codes
The request was received, understood, and accepted.
200 – OK
- Everything is good to go! This is what you hope you receive.
201 – Created
- The request was accepted, and the resource was created. This one is fairly common in modern software-defined datacenters.
202 – Accepted
- This one is similar to response code 201, but it means there’s a delay in processing the request. Bear in mind, there is no facility to re-send an updated status code. You will have to check on its pending status manually.
Redirection HTTP Response Codes
This means further action must be taken to complete the request.
301 – Permanent Redirect
- This means the page you requested has moved to a different URL permanently. The new, permanent URL should be given in the Location field in the response.
302 – Temporary Redirect
- This means the page you requested has moved to a different URL temporarily. The new, temporary URL should be given in the Location field in the response.
Client Error HTTP Response Codes
This means the request contains incorrect syntax or the request cannot be fulfilled.
400 – Bad Request
- This response is common in the cloud datacenter world. It means the request could not be understood by the server due to a malformed syntax.
404 – Not Found
- This is perhaps the most well-known HTTP status code. It comes up when the server can’t find the page you requested. Since this could be temporary, you can try again. If the server knows this is not temporary it should use code 410 instead.
410 – Gone
- This code is similar to 404, but lesser known. It means the requested page is no longer available and there is an associated forwarder. It’s different because it means the page is not coming back. This is useful for search engines to handle page removal.
Server Error HTTP Response Codes
This means the server has failed to fulfill an apparently valid request.
500 – Internal Server Error
- This code tells us that the server met an unexpected condition and could not provide the resource. It’s generic.
503 – Service Unavailable
- This could mean the server is either temporarily overloaded or down for maintenance. Either way, it received an invalid response from an upstream server it accessed while trying to fulfill the request.
So, with all of that ground covered, when you’re working with a service that is built on HTTP, like a cloud-based datacenter, you can start to make sense of what you receive in return–when things go as expected or even when they don’t. A lot of this data was pulled directly from RFC2616, which was copyrighted in 1999. And, let’s remember, all of this is only just over 30 years old. Computers and networking has been around much longer. It’s fun to dig into the history of all of this–at least for me. So, go out there and be curious about how our world works.
Did you know any of these response codes? I’m sure you knew 404, since we come across it often. Did you know 200 or 100?