Digg’s Sad HTTP Error handling.

Digg has lame HTTP error handling.

Fetch any Digg page which should 404:

Let’s try to fetch http://digg.com/asdfffffffffsdf (which surely won’t exist).

HTTP/1.1 302 Found
Location: http://digg.com/error

FOUND? Are you sure?

Let’s check out http://digg.com/error

HTTP/1.1 404 Not Found

What? Wait. I’m not sure I follow. You just told me you found a page called http://digg.com/asdfffffffffsdf which is located here http://digg.com/error but when I try to fetch that it returns HTTP 404.

If I were a robot I would be very confused.

I assume they’re doing this because they want to return a custom error page. This is not the right thing to do. You should configure Apache to serve a custom HTML page for your 404s.

Even caching HTTP servers can implement this.

  1. mdierken

    Think of “302” as a symbolic link. It doesn’t necessarily know whether the target of the symbolic link exists or not.

    “The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests.”

    If the server knows the target doesn’t exist (and in this case it’s pretty likely that it does know, otherwise it wouldn’t be able to serve it to begin with) it probably should just return a 404, especially if it knows the resource isn’t going to come into existence anytime soon (although a 410 could be used too). This example is pretty silly and the extra redirect is just a waste.

%d bloggers like this: