3 digit HTTP status codes - what are they, which are most common, which should be a concern?
We often talk during web related course / course modules about the status codes that are returned by servers - but I don't think I've ever written up a (near?) complete list. They are all three digit codes, and they're grouped by hundreds - so 200 series code are success, 400 codes are requests that can't be met, etc. Here's the list:
Informational - 100 series
Continue -
100
Switch Protocol -
101
Success - 200 series
OK -
200
Created -
201
Accepted -
202
NonAuthoritative Information -
203
No Content -
204
Reset Content -
205
Partial Content -
206
Redirection - 300 series
Multiple Choice -
300
Moved Permanently -
301
Found -
302
See Other -
303
Not Modified -
304
Use Proxy -
305
Temporary Redirect -
307
Client Error - 400 series
Bad Request -
400
Unauthorized -
401
Payment Required -
402
Forbidden -
403
Not Found -
404
Method Not Allowed -
405
Not Acceptable -
406
Proxy Authentication Required -
407
Request TimeOut -
408
Conflict -
409
Gone -
410
Length Required -
411
Precondition Failed -
412
Request Entity Too Large -
413
Request URI Too Long -
414
Unsupported Media Type -
415
Requested Range Not Satisfiable -
416
Expectation Failed -
417
Server Error - 500 series
Internal Server Error -
500
Not Implemented -
501
Bad Gateway -
502
Service Unavailable -
503
Gateway TimeOut -
504
Version Not Supported -
505
other extension / non standard / no longer used codes listed at the end of this article
So - which are the important codes? As a web site provider, you want to take a very careful look at the 500 series codes as they indicate something potentially
wrong with your web server. Anything more that 0.5% in the 400 series would worry me too, as that indcates that you may have users being (mis)lead into asking for pages that don't exist, or knocking on locked doors.
How can we analyse the relative number of access codes? I've written a ruby program (source code
[here]) to look through server log files - defaulting to 100 days of data, and here are my results starting 1st June 2011:
wizard:sep11 graham$ ./ruby_100
200 - 96.04% 10750468
206 - 0.06% 7033
226 - 0.00% 8
250 - 0.01% 1015
301 - 0.12% 13330
302 - 0.07% 7554
304 - 1.70% 190774
400 - 0.01% 965
403 - 0.60% 67093
404 - 1.38% 154432
405 - 0.00% 17
408 - 0.01% 759
416 - 0.00% 8
500 - 0.01% 642
111941 accesses per day
4664.2 accesses per hour
77.74 accesses per minute
wizard:sep11 graham$
Studious readers will note that we have very many code 403 and 404 codes than I said were acceptable just up above. This is because our web server is actually programmed to return these codes to certain intrusion attempts in the (perhaps vain) hope that those intrusion attempts will think there's nothing there and give up. Easy enough to do, but it does mean that my figures here need a little more careful reading than you might have expected.
Status codes covered in the web sections of many courses. They're particularly mentioned and used on the
Deploying LAMP,
Deploying Apache / Tomcat and
PHP courses. A little ironically, the sample program that I've used here comes as a follow up from last week's
Ruby course.
The following extra codes may be seen very occasioanlly. Most of them are module / vendor specific extensions, and / or no longer used. Code 418 was an April Fool's joke ... RFC 2324, the Hyper Text Coffee Pot Control Protocol -
[see here].
Processing -
102
Checkpoint -
103
Request URI too long -
122
Multi-Status -
207
IM Used -
226
Switch Proxy -
306
Resume Incomplete -
308
I'm a Teapot -
418
Unprocessable Entity -
422
Locked -
423
Faild dependency -
424
Unordered Collection -
425
Upgrade Required -
426
No Response -
444
Retry With -
449
Blocked by Windows Parental Control -
450
Client Closed Request -
499
Varient also negotiates -
506
Insufficient storage -
507
Bandwidth limit exceeded -
509
Not extended -
510 (written 2011-09-11)
Associated topics are indexed under
A207 - Web Application Deployment - HTTP [2918] Downloading a report from the web for further local analysis - (2010-08-13)
[2738] What is all this SESSION stuff about? (PHP) - (2010-04-25)
[2596] Http protocol - what does a web server send - (2010-01-24)
[2321] Uploading and Downloading files - changing names (Perl and PHP) - (2009-08-04)
[1549] http, https and ajp - comparison and choice - (2008-02-22)
[1503] Web page (http) error status 405 - (2008-01-12)
[1378] Etag in http headers - what is it? - (2007-10-03)
[484] Setting the file name for a downloaded document - (2005-11-03)
R114 - Ruby on the Web [3623] Some TestWise examples - helping use Ruby code to check your web site operation - (2012-02-24)
[3431] Ruby at both extremes of your website - (2011-09-10)
[2607] Answers on Ruby on Rails - (2010-01-30)
[2605] Ruby on Rails - a sample application to teach you how - (2010-01-30)
[1891] Ruby to access web services - (2008-11-16)
H112 - PHP - Further Web Page and Network Handling [3568] Telling which ServerAlias your visitor used - useful during merging domains - (2012-01-04)
[3540] Easy session example in PHP - keeping each customers data apart - (2011-12-06)
[3036] Sending out an email containing HTML from within a PHP page - (2010-11-07)
[2729] Uploading a document or image to its own URL via a browser - (2010-04-18)
[2679] How to build a test harness into your PHP - (2010-03-16)
[2632] Shipping a test harness with your class in PHP - (2010-02-12)
[1518] Downloading data for use in Excel (from PHP / MySQL) - (2008-01-25)
[1515] Keeping staff up to date on hotel room status - (2008-01-22)
[1505] Script to present commonly used images - PHP - (2008-01-13)
[1496] PHP / Web 2 logging - (2008-01-06)
[1495] Single login and single threaded models - Java and PHP - (2008-01-04)
[1485] Copyright and theft of images, bandwidth and members. - (2007-12-26)
[1379] Simple page password protection - PHP - (2007-10-04)
[1355] .php or .html extension? Morally Static Pages - (2007-09-17)
[1210] PHP header() function - uses and new restrictions - (2007-05-30)
[1187] Updating a page strictly every minute (PHP, Perl) - (2007-05-14)
[1183] Improving searches - from OR to AND? - (2007-05-11)
[1114] PHP Image upload script - (2007-03-21)
[1009] Passing GET parameters through Apache mod_rewrite - (2006-12-27)
[936] Global, Superglobal, Session variables - scope and persistance in PHP - (2006-11-21)
[904] Of course I'll tell you by email - (2006-10-25)
[847] Image maps for navigation - a straightforward example - (2006-08-28)
[789] Hot answers in PHP - (2006-07-02)
[767] Finding the language preference of a web site visitor - (2006-06-18)
[675] Adding PHP tags to an old cgi program - (2006-04-08)
[603] PHP - setting sort order with an associative array - (2006-02-13)
[565] Using PHP to output images, XML, Style sheets, etc - (2006-01-15)
[542] Morning image, afternoon image - (2005-12-26)
[537] Daily Image Santafied - (2005-12-22)
[451] Accessing a page via POST from within a PHP script - (2005-09-26)
[443] Server side scripting of styles to suit the browser - (2005-09-12)
[425] Caching an XML feed - (2005-08-26)
[410] Reading a news or blog feed (RSS) in your PHP page - (2005-08-12)
[376] What brings people to my web site? - (2005-07-13)
[372] Time calculation in PHP - (2005-07-08)
[356] Sudoku helper or sudoku cheat - (2005-06-23)
[345] Spotting a denial of service attack - (2005-06-12)
[314] What language is this written in? - (2005-05-17)
[220] When to use Frames - (2005-02-19)
Some other Articles
Moving from scripting to Object Orientation in PythonSorta sorting a hash, and what if an exception is NOT thrown - RubySundays - and over eatingExceptions - a fail-safe way of trapping things that may go wrong3 digit HTTP status codes - what are they, which are most common, which should be a concern?Sigils - the characters on the start of variable names in Perl, Ruby and FortranSearching through all the files in or below a directory - Ruby, Tcl, PerlHow many days to Christmas?What is on the Melksham Agenda?