RE: GET/HEAD support "MUST"

William A. Rowe, Jr. wrote:
> Robert Brewer wrote:
> >
> >    An origin server SHOULD return the status code 405 (Method Not
> Allowed)
> >    if the method is known by the origin server but not allowed for
> the
> >    requested resource, and 501 (Not Implemented) if the method is
> >    unrecognized or not implemented by the origin server. The methods
> GET
> >    and HEAD MUST be supported by all general-purpose servers.
> >
> > I think that pretty clearly states that, for GET and HEAD, 405 is the
> recommended approach, not 404. Other methods may alternately use 501.
> The only case I can think of for 404 is if the resource identified by
> the Request-URI doesn't implement *any* method (or, saying that a
> different way, "if there is no resource identified by that Request-
> URI").
> 
> There are several reasonable answers;
> 
>   403 - the server prohibits GET/HEAD against this (all) URI(s)
>   404 - the server has nothing to offer (a write-only server)
>   405 - the server prohibits method GET/HEAD (might confused some
> clients)

Thanks for the correction. I didn't believe you at first ;) but your post prompted me to do a bit of digging and I found lots of support for 404. Somehow I was under the impression that a 404 response code meant "no such resource" when it's better to say it means "no such representation" [1][2]. In fact, the response entity in that case is "a representation of a 404 response" [3]. For anyone who was misguided as I was, read the links below. ;)

I think I'd still prefer the more-specific "405" in most cases to the catch-all "404". But I can see how 404 is a valid response, and might be preferred for maximizing interop with clients, some of which may not gracefully deal with 405.


Robert Brewer
fumanchu@aminus.org

[1] http://markmail.org/message/jfyiebtqhl4wlsme

[2] http://lists.w3.org/Archives/Public/uri/2004Jun/0006.html

[3] http://markmail.org/message/54jr3v2s5uy7jjzx

Received on Friday, 30 January 2009 18:34:15 UTC