views:

233

answers:

4

So why does almost every example I can find (including this question form about a year ago) say that a 404 header should be HTTP/1.0 404 Not Found when we've really been using HTTP 1.1 for over a decade? Is there any reason not to send HTTP/1.1 404 Not Found instead?

(Not that it matters all that much... I'm mostly just curious.)

A: 

Looking at both the 1.1 and 1.0 RFCs, 404 is there in both - so it's probably for no other reason than for the server to communicate to the client that it's operating on http 1.1.

That said - if a server responds with 404 over Http 1.1, it implies that it could have returned 410 - Gone instead to indicate a resource that used to exist but no longer does. This status code is not part of 1.0, and therefore this information could be useful to a client (especially web crawlers).

EDIT

Sorry - this answer is probably answering the other way around! I reckon you can probably count on only a few hands the number of public web servers that will be bothering to remember all the resources that used to exist and which no longer do (no way I'd code that into my web server!) - so therefore it's probably best to respond with the 1.0 404 to indicate that 'it's just not there' rather than 'that's not here, but other stuff around the site might used to have been but no longer - in which case I could have sent you a 410'.

There's also the fact that you're allowing 1.0-only clients to work with your site.

That said - it's all a bit pedantic.

Andras Zoltan
A: 

It does not matter all that much. The client is responsible for telling the server which version of HTTP it uses. Then, the server is supposed to answer with the same version. This does not always happen; I just got this response from a server:

$ telnet example.com 80
Trying 123.123.123.123...
Connected to example.com.
Escape character is '^]'.
GET /fork HTTP/1.0

HTTP/1.1 404 Not Found
Content-Length: 1635
Content-Type: text/html
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Tue, 04 May 2010 22:30:36 GMT
Connection: close

I asked the server to use HTTP 1.0, but it went ahead and responded with HTTP 1.1.

Kevin Panko
+1  A: 

I'd have thought that the response should be HTTP/1.0 404 Not Found if the request was a HTTP 1.0, and HTTP/1.1 404 Not Found if the request was HTTP 1.1.

In practice, it's going to be easier for servers to returned canned responses, and the HTTP 1.0 response will be understood by both 1.0 and 1.1 clients, so safest to return that. If you know the client understands 1.1 (e.g. because that's what it asked for), then the 1.1 response should work.

Arguably, play it safe and send the 1.0 response.

skaffman
Yep, no need to use 1.1 when you're not using any 1.1 features
Earlz
+1  A: 

The usage of HTTP version can be based on the following factors:

  • Your web server support for HTTP 1.0 or 1.1
  • The web browser's support for HTTP 1.0 or 1.1
  • Your preference as a web developer on which protocol version to use

Modern browsers can support both 1.0 and 1.1 well. The key differences between the 2 protocol can be found: http://www8.org/w8-papers/5c-protocols/key/key.html

However there's no key differences in the usage of 404 Not Found. However do be consistent for your whole website. i.e. if you use HTTP/1.1, you use it throughout your website.

thephpdeveloper