Where to find Apache response codes and how to determine their meaning.

Locating your log file on your server.

Most logs files in Ubuntu are stored in /var/log/ and the folders under /var/log/ . To find all logs on your server got to a terminal window and type

locate log

then hit enter and all logs on your server will be listed.

In Particular have a look at /var/log/apache2/access.log and /var/log/apache2/error.log depending on the server your site is these logs may be in a different location.

In Virtualmin the job is much easer. After you have logged in to your Virtualmin console select Virtualmin> Logs and Reports> and then either select Apache Access Log or Apache Error Log and you will get a list of the last x number of records.

Finding the Apache response codes in your log file.

When checking your log files you will come across two sets of numbers that don’t seem to stand for anything. Have a look at these two example of standard log file entry.

ltr

208.115.111.67 – – [28/May/2011:00:44:05 +0800] “GET /robots.txt HTTP/1.1” 200 358 “-” “Mozilla/5.0 (compatible; Ezooms/1.0; ezooms.bot@gmail.com)”

208.115.111.67 – – [28/May/2011:01:33:53 +0800] “GET /WebDesign/WebDesign.php HTTP/1.1” 200 19388 “-” “Mozilla/5.0 (compatible; Ezooms/1.0; ezooms.bot@gmail.com)”

For this exercise ignore ever thing up to and including “GET /robots.txt HTTP/1.1” in the first log entry and “GET /WebDesign/WebDesign.php HTTP/1.1” in the second. What we are interested in here is the 200 358 and the 200 19388 in the two lines consecutively. To begin with I will deal with the second number first because it requires the shortest explanation.

In each case the second number represents the amount of data passed from your website (the server) to the computer requesting the information (the client). In other words the page passed back to the computer making the request or the client EG an error page. The first number is the Apache response code or the code for, what action the server took to the request from the client.

Response codes can be divided into 5 categories.

Response codes categories

1xx:RedirectionFurther action must be taken in order to complete the request
2xx:SuccessThe action was successfully received, understood, and accepted
3xx:RedirectionFurther action must be taken in order to complete the request
4xx:Client ErrorThe request contains bad syntax or cannot be fulfilled
5xx:Server ErrorThe server failed to full fill an apparently valid request
*NOTENot all numbers in any category have been used.

100-199 Continue with Client Requests.

100ContinueMeans that the server has received the request and that the client should proceed to send the request body (in the case of a POST request).
101Switching ProtocolsMeans the computer requesting the information has asked the server to switch protocols and the server is acknowledging that it will.
102Processing (WebDAV)A WebDAV request may contain many sub-requests so it may take a long time to complete the request. This code indicates that the server has received the request and is processing it. In laymen terms “please hold the line”.

200-299 Successful Client Requests.

 200OKStandard response for success.
 201CreatedA confirmation that a new page has been created.
 202AcceptedThe client’s request was accepted, but it has not been processed yet.
 203Non-Authoritative InformationThe server successfully processed the request, but is returning information that may be from another server.
 204No ContentThe server has successfully processed the request, but there is no content to return.
 205Reset ContentThe server has processed the request successfully, but is not returning any content. Unlike a 204 response this response requires that the client refresh the browser.
 206Partial ContentThe requested file wasn’t downloaded entirely. The server is delivering only part of the requested file or page due to a range header (partial request – range of bytes) sent by the client. This is used by tools like wget to enable resuming of interrupted downloads, or split a download into multiple simultaneous streams. This response code is also returned when the user clicks the stop button before a page is loaded.
 207Multi-StatusThe message body that follows is an XML message and can contain a number of separate response codes, depending on how many sub-requests were made.
 208Already ReportedThe members of a DAV binding have already been enumerated in a previous reply to this request, and are not being included again. See also 102 Processing (WebDAV) above.
 226IM UsedThe server has fulfilled a GET request for the file or page, and the response is a representation of the result of one or more instance-manipulations applied to the current instance. A response received with a status code of 226 MAY be used by a cache, in conjunction with a cache entry for the base instance, to create a cache entry for the current instance.

300-399 Client Request Redirected.

 300Multiple ChoicesIndicates multiple options for the file or page that the client may follow. The requested address refers to more than one file. Depending on how the server is configured, you get an error or a choice of which page you want. For instance, it could be used to present different format options for video, list files with different extensions, or word sense disambiguation.
 301Moved PermanentlyMoved Permanently This and all future requests should be directed to the new location of the file. If the server is set up properly it will automatically redirect the client to the new location of the file.
 302FoundThe page has been found but not in the location requested by the client. The page has been moved temporarily, and the new URL is available. You should be sent there by the server.
 303See OtherThe response to the request can be found at another URI using a GET method. When received in response to a PUT, it should be assumed that the server has received the data and the redirect should be issued with a separate GET message.
 304Not ModifiedNot Modified Indicates the file or page has not been modified since the last requested. This code will be returned if the file has not changed since the date of the last request. Search engine robots may generate a lot of these response codes.
 305Use ProxyThe requested file or page MUST be accessed through the proxy given by the Location field. The Location field gives the URI of the proxy. The recipient is expected to repeat this single request via the proxy. 305 responses MUST only be generated by origin servers. Primarily for security reasons many clients such as Firefox and Internet Explorer do not correctly handle responses with this responses code.
 306Switch ProxyNo longer used. Originally meant “Subsequent requests should use the specified proxy”.
 307Temporary RedirectIn this case, the request should be repeated with another URI however, future requests should still use the original URI.
 308Permanent Redirect (proposed)The request, and all future requests should be repeated using another URI. Response 307 and response 308 (as proposed) parallel the behaviours of 302 and 301, but do not allow the HTTP method to change. So, for example, submitting a form to a permanently redirected file or page may continue smoothly.

400-499 Client Request Errors.

400Bad RequestThere is a syntax error in the clients request and the request has been denied.
401UnauthorisedThe requesting header sent by the client did not contain the necessary authentication codes, and the client is denied access.
402Payment Required Reserved for future use.The original intention was that this code might be used as part of some form of digital cash or micropayment scheme, but that has not happened, and this code is not usually used. As an example of its use, however, Apple’s MobileMe service generates a 402 error if the MobileMe account is delinquent. In addition, YouTube uses this status if a particular IP address has made excessive requests, and requires the person to enter a CAPTCHA.
403ForbiddenThe request was a valid request, but the server is refusing to respond to it. Unlike a 401 Unauthorized response, authenticating will make no difference. On servers where authentication is required, this commonly means that the provided credentials were successfully authenticated but that the credentials still do not grant the client permission to access the file or page (e.g. a recognized user attempting to access that is restricted to their access level).
404Not FoundThe requested file or page could not be found but may be available again in the future. Possibly because the file or page was deleted, or never existed. Sometimes caused by misspellings of URLs. Subsequent requests by the client are permissible.
405Method Not AllowedA request was made of a file or page using a request method not supported by that file or page for example using a GET on a form which requires data to be presented via POST, or using PUT on a read-only file or page. The method the client is using to access the file is not allowed.
406Not AcceptableThe requested file or page is only capable of generating content not acceptable according to the Accept headers sent in the request. The requested file exists but cannot be used as the client system doesn’t understand the format the file is configured for.
407Proxy Authentication RequiredThe requested file or page is only capable of generating content not acceptable according to the Accept headers sent in the request. The requested file exists but cannot be used as the client system doesn’t understand the format the file is configured for.
408Request TimeoutThe server timed out waiting for the request. According to W3 HTTP specifications: “The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.” Request. The server took longer than its allowed time to process the request. Often caused by heavy net traffic.
 409ConflictIndicates that the request could not be processed because of a conflict in the request, such as an edit conflict or too many concurrent requests for a single file by the client.
 410GoneIndicates that the file or page requested is no longer available and will not be available again. This should be used when a file or page has been intentionally removed and the file or page should be purged. Upon receiving a 410 status code, the client should not request the file or page again in the future. Clients such as search engines should remove the file or page from their indices. Most use cases do not require clients and search engines to purge the file or page, and a “404 Not Found” may be used instead.
 411Length RequiredThe request did not specify the length of its content, which is required by the requested file or page.
 412Precondition FailedThe server does not meet one of the preconditions that the requester put on the request. A certain configuration is required for this file to be delivered, but the client has not set this up.
 413Request Entity Too LargeThe request is larger than the server is willing or able to process. The requested file was too big to process.
 414Request-URI Too LongThe URI provided was too long for the server to process. The address the client entered was longer than the server is allowed to process.
 415Unsupported Media TypeThe client has a media type which the server does not support. For example, the client attempts to uploads an image as image.xml but the server requires that images use a different format.
 416Requested Range Not SatisfiableThe client has asked for a portion of the file, but the server cannot supply that portion. For example, if the client asked for a part of the file that lies beyond the end of the file.
 417Expectation FailedThe server cannot meet the requirements of the Expect request-header field. The expectation given in an Expect request-header field could not be met by this server, or, if the server is a proxy, the server has unambiguous evidence that the request could not be met by the next-hop server.
 418I’m a teapotThis code was defined in 1998 as one of the traditional IETF April Fools’ jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol, and is not expected to be implemented by actual HTTP servers.
 420Enhance Your Calm (Twitter)Not part of the HTTP standard, but returned by the Twitter Search and Trends API when the client is being rate limited. Other services may wish to implement the 429 Too Many Requests response code instead.
 422Unprocessable Entity (WebDAV; RFC 4918)The request was well-formed but was unable to be followed due to semantic errors or syntax errors.
 423Locked (WebDAV; RFC 4918)The file or page that the client is trying to accessed is locked by the server.
 424Failed Dependency (WebDAV; RFC 4918)The request could not be performed on the file or page because the requested action depended on another action and that previous action failed. For example, if a command in a PROPPATCH method fails, then, at minimum, the rest of the commands will also fail with 424 (Failed Dependency).
 425Unordered Collection (Internet draft)Defined in drafts of “WebDAV Advanced Collections Protocol” not yet in use.
 426Upgrade Required (RFC 2817)The client should switch to a different protocol such as TLS/1.0.
 428Precondition Required (RFC 6585)The origin server requires the request to be conditional. Its typical use is to avoid the “lost update” problem, where a client GETs a resource’s state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict. By requiring requests to be conditional, the server can assure that clients are working with the correct copies.
 429Too Many Requests (RFC 6585)The user has sent too many requests in a given amount of time. Intended for use with rate limiting schemes.
 431 Request Header Fields Too Large (RFC 6585)The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large.
 432Request ThrashedThe server has received too many requests and is currently busy trying to handle them, likely causing other problems. The server’s hosed.
 444No Response (Nginx)Used in Nginx logs to indicate that the server has returned no information to the client and closed the connection (useful as a deterrent for malware).
 449Retry With (Microsoft)A Microsoft extension. The request should be retried after performing the appropriate action. Often search-engines or custom applications will ignore required parameters. Where no default action is appropriate, the Aviongoo website sends a “HTTP/1.1 449 Retry with valid parameters: param1, param2, . . .” response. The applications may choose to learn, or not.
 450Blocked by Windows Parental Controls (Microsoft)A Microsoft extension. This error is given when Windows Parental Controls are turned on and are blocking access to the given webpage.
 451Unavailable For Legal Reasons (Internet draft)Defined in the internet draft “A New HTTP Status Code for Legally-restricted File or pages”. Intended to be used when file or page access is denied for legal reasons, e.g. censorship or government-mandated blocked access. A reference to the 1953 dystopian novel Fahrenheit 451, where books are outlawed.
 451Redirect (Microsoft)Used in Exchange ActiveSync if there either is a more efficient server to use or the server can’t access the users’ mailbox.     The client is supposed to re-run the HTTP Autodiscovery protocol to find a better suited server.
 494Request Header Too Large (Nginx) Nginx internal code similar to 431 but it was introduced earlier.
 495Cert Error (Nginx)Nginx internal code used when SSL client certificate error occurred to distinguish it from 4XX in a log and an error page redirection.
 496No Cert (Nginx)Nginx internal code used when client didn’t provide certificate to distinguish it from 4XX in a log and an error page redirection.
 497HTTP to HTTPS (Nginx)Nginx internal code used for the plain HTTP requests that are sent to HTTPS port to distinguish it from 4XX in a log and an error page redirection.
 499Client Closed Request (Nginx)Used in Nginx logs to indicate when the connection has been closed by client while the server is still processing its request, making server unable to send a status code back.

500-599 Server Side Errors.

500Internal Server ErrorA generic error message, given when no more specific message is suitable. EG: Internal Server Error. A nasty response that is usually caused by a problem in the Perl code on the server when a CGI program is run.
501Not ImplementedThe server either does not recognize the request method, or it lacks the ability to fulfill the request. In either event the request cannot be carried out by the server.
502Bad GatewayThe server was acting as a gateway or proxy and received an invalid response from the upstream server. Or the server you’re trying to reach is sending back errors.
503Service UnavailableThe server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state. Temporarily Unavailable the service or file that is being requested is not currently available.
504Gateway TimeoutThe server was acting as a gateway or proxy and did not receive a timely response from the upstream server. The gateway has timed out. Like the 408 timeout error, but this one occurs at the gateway of the server.
505HTTP Version Not SupportedThe server does not support the HTTP protocol version used in the request. The HTTP protocol the client is asking for is not supported.
506Variant Also Negotiates (RFC 2295)Transparent content negotiation for the request results in a circular reference. The 506 status code indicates that the server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process. This proses could cause an infinite loop if the server does not stop it.
507Insufficient Storage (WebDAV; RFC 4918)The server is unable to store the representation needed to complete the request.
508Loop Detected (WebDAV; RFC 5842)The server detected an infinite loop while processing the request (sent in lieu of 208).
509Bandwidth Limit Exceeded (Apache bw/limited extension)This status code, while used by many servers, is not specified in any RFCs.
510Not Extended (RFC 2774)Further extensions to the request are required for the server to fulfill it.
511Network Authentication Required (RFC 6585)The client needs to authenticate to gain network access. Intended for use by intercepting proxies used to control access to the network (e.g. “captive portals” used to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).
598Network read timeout error (Unknown)This status code is not specified in any RFCs, but is used by Microsoft Corp. HTTP proxies to signal a network read timeout behind the proxy to a client in front of the proxy.
599Network connect timeout error (Unknown)This status code is not specified in any RFCs, but is used by Microsoft Corp. HTTP proxies to signal a network connect timeout behind the proxy to a client in front of the proxy.

Comments

2 responses to “Where to find Apache response codes and how to determine their meaning.”

  1. […] ← Previous […]

  2. […] time eg between 6 and 18 hours. Then at some random time all that any visitor is able to see is an Internal Server Error message. To anyone trying to get to your site, your site appears to be broken. For more information […]