Today I have reviewing some of my projects and found that I was designing some application without awaring http status codes. You might want to ask me that what exactly Http Status Code is and do we need to know about it ? I say yes.
We are using a protocol called HTTP to transfer documents from one network client to others on Internet. We request resources like web pages from others computers like web servers as a client and receive the requested resources with status codes in header.
Lets see in action. Open your terminal.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
You can see the response comes with the header as 200 OK. This means requested resource is found and return as expected.
There are a few of these codes you should know by heart as a web developer.
200 : Standard response for successful HTTP requests
302 : Temporary response to request found via alternative URI [If you have done curl to http://google.com , you might get this response coz it is redirected towards google.com.mm]
304 : Resource has not been modified since last requested [Most of the assets like css,js and images would be returned as 304 then the browser will use the local cache instead of getting new ones from server.]
4xx client error
404 : Requested resource you send is not found on server [ It is your fault , check your request again]
444 : Server returns no information and closes the connection
5xx Server Error
500 : Generic Error [ Something is wrong within the server ]
503 : Server is currently unavaiable [ In other words , Server is down ]
504 : Gateway did not receive response from upstream server [ If you are sending your request via a proxy , upstream server is not giving back anything to your proxy server ]
Ok , this might be enough for most of us. Anyone who want further learning about HTTP Status Codes , here is a good place.