Returning alternate HTTP codes for unpublished content Sometimes when nodes are unpublished, they are not meant to be taken live again.

Under those circumstances, I would like to return a 410 Gone status, instead of the default 403 Forbidden.

Implementing the 410 itself is a 1 line patch to Page manager, but I soon realize that there is no easy way to get the response to the client, as the router system itself checks the node status, and denies access.

How can I force the menu router to process my request for an unpublished node as usual?
I haven't tried this myself, but I think the main problem is that in your cases, the "unpublished status" means two things.

I think your best bet is to use something like Workbench Moderation, and defined a "retired" state.  Then, in a hoot_init(), check the status, and generate the 410.

Something like:

function mymodule_init ()
{
   $node = menu_get_object();
   if (isset($node-&gt;nid) &amp;&amp; this_is_a_retired_node($node)) {
     drupal_add_http_header('Status', '410 Gone');
     drupal_exit(); // may want exit instead; not sure of other hook_inits()s should run
   }
}


I think you have to take the sledgehammer approach so that you don't get too far into the request where you may have a race condition with other modules.