We like to post updates to Facebook and Twitter when publishing new content. We are running into a problem, however, in that anonymous users will get the "Access Denied" page until the cache recycles to show them the new content.

Currently, we're caching pages for anonymous users for three minutes. How do we keep our cache, yet allow anonymous users to see new content immediately as it's published?

For what it's worth, we are not using Memcache, Varnish or anything outside of the standard Drupal page caching.

  • clearing cache after adding new content is consider an option for you?
    – Aboodred1
    Commented Feb 26, 2013 at 23:17
  • Yes, that's certainly an option for us. Commented Feb 27, 2013 at 7:52

2 Answers 2


I'm not sure why you're getting "Access Denied" when you view new content as anonymous user. New content shouldn't be cached yet.

As a solution for your issue, you can clear all Drupal cache or only Drupal page cache after adding new content.

The following code will clear page cache after inserting new content:

   function MODULE_NAME_nodeapi(&$node, $op, $teaser, $page) {
      switch ($op) {
        case 'insert':
          cache_clear_all('*', 'cache_page', TRUE);

Note: This code will not work on Drupal 7

  • It's puzzling to us as well, but the cache is the only thing we can think it could be as the new content is available to anonymous users after a minute or two (and it's available to authenticated users right away). Commented Feb 27, 2013 at 7:54
  • Do have any node access modules installed on your Drupal project?
    – Aboodred1
    Commented Feb 27, 2013 at 15:02
  • No, pretty vanilla. I think your approach will serve us best. Thank you. Commented Feb 27, 2013 at 15:39

403 "Access Denied" on a cache miss seems odd to me. One thing to try is http://drupal.org/project/adbc as it makes the Dupal cache operate like one expects.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.