What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

In cases where a question was deleted, a 404 response is not technically accurate, especially when the body of the response indicates:

This question was removed from Stack Overflow for reasons of moderation.

Content that used to exist but doesn't anymore is gone, especially if the server knows what content the user is looking for but knows it's gone.

With recent concerns raised about external link rot regarding popular deleted questions, one way to help external link checking agents deal with this would be to use a proper response code. This doesn't apply so much to questions that are not sufficiently popular or meaningful, but more for the ones that have external links.

I propose that for deleted questions with more than 3 up-votes or older than 60 days, the response code should be 410, not 404.

Also, as a final point of support, abiding by the HTTP spec as much as is reasonable seems to be about as closely aligned as possible to the mission of Making the Internet a Better Place.

Note: I tagged this as instead of since, according to the HTTP spec 410 Gone is the correct response code

share|improve this question
2  
I agree with the request in general, but I'm not sure why question with more than 3 upvotes or older than 60 days the response code should be different? Seeing as both those questions and all others are all gone? –  Pëkka Mar 9 '12 at 17:48
1  
@Pekka'sReputationBordello - I only put that in there because it seems those two measures are used to determine which questions are more worthy of slightly-special treatment than others. Ideally deleted is always 410 Gone at least for a while. –  cdeszaq Mar 9 '12 at 17:51
    
410 clearly isn't the correct response code, as the question suggests, so @MarkTrapp's answer is the correct one. That said, I am still not convinced that 404 is the most correct response code. –  cdeszaq Mar 9 '12 at 18:11

1 Answer 1

up vote 21 down vote accepted

No, they shouldn't. 410 Gone is when content is completely obliterated from the web and, most importantly, this condition is permanent. This is not the case for any question on Stack Exchange: except in the truly exceptional, programmer-on-a-boat situations questions can be undeleted at any time.

From RFC 2616 (emphasis mine):

10.4.11 410 Gone

The requested resource is no longer available at the server and no forwarding address is known. This condition is expected to be considered permanent. Clients with link editing capabilities SHOULD delete references to the Request-URI after user approval. If the server does not know, or has no facility to determine, whether or not the condition is permanent, the status code 404 (Not Found) SHOULD be used instead. This response is cacheable unless indicated otherwise.

share|improve this answer
8  
Well spotted, but I'm not sure I agree with the argument. For all intents and purposes, the vast majority of questions is expected to stay permanently deleted - otherwise, it would not be deleted, but closed. Undeletions are the exception, and Clients with link editing capabilities SHOULD delete references to the Request-URI after user approval sounds like something SO wants for deleted questions –  Pëkka Mar 9 '12 at 17:49
2  
@Pekka'sReputationBordello If the server doesn't know whether a question is permanently deleted (i.e., there's no mechanism to prevent someone from undeleting it like a lock or a dev delete), that's what 404 Not Found is for. –  user149432 Mar 9 '12 at 17:51
1  
I see your point regarding the fact that everything is, at the very lowest levels, only a soft-delete. That said, a 404 is just about as generic a return code as possible. Perhaps a 403 is more accurate then, since some users still have access? Especially since the response body indicates that it was taken down due to moderator attention, it doesn't seem that there is any issue with indicating that the content is still there, just not available to the user looking for it. –  cdeszaq Mar 9 '12 at 17:55
4  
@cdeszaq 403 Forbidden is also a permanent condition: it's not intended to say "you just need to log in". See my answer on Programmers for more detail regarding 403 Forbidden vs 404 Not Found. –  user149432 Mar 9 '12 at 18:00
1  
@MarkTrapp - Ahh, I see. Thank you for pointing me to that. It corrected a misconception on my part. Does that then mean that the correct response then to the deleted questions should be a 401? I could see 401 being problematic for the SE network, however, since authentication isn't handled via HTTP headers, as the 401 spec seems to indicate. –  cdeszaq Mar 9 '12 at 18:09
    
@cdeszaq that's correct: 401 Unauthorized is problematic due to differing authentication methods. Generally, 404 Not Found is a perfectly acceptable response when no other response is applicable (per the last sentence in the 404 Not Found section) –  user149432 Mar 9 '12 at 18:14
1  
@MarkTrapp - Seems like a hole in the http spec around authentication to me, but thank you very much for enlightening me. Means I'll have to correct some of my previous work, but better to be less wrong, even if you can't be completely correct! –  cdeszaq Mar 9 '12 at 18:19
    
@user149432 — The error 403 “forbidden” is not supposed to be more permanent than the error 404 “not found”. –  Nicolas Barbulesco May 24 '13 at 1:53
    
Arguments against 410 notwithstanding, 404 is not appropriate either. According to the spec, 404 is indicated when The server has not found anything matching the Request-URI. In the case of deleted posts, the server has certainly found something. There is a critical distinction between what should be 404: magento.stackexchange.com/00000 and what should not be a 404: magento.stackexchange.com/questions/32098 –  kojiro Aug 13 at 12:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .