Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
clearing cache after adding new content is consider an option for you? – Aboodred1 Feb 26 '13 at 23:17
Yes, that's certainly an option for us. – DeepFriedBits Feb 27 '13 at 7:52
up vote 0 down vote accepted

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

share|improve this answer
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). – DeepFriedBits Feb 27 '13 at 7:54
Do have any node access modules installed on your Drupal project? – Aboodred1 Feb 27 '13 at 15:02
No, pretty vanilla. I think your approach will serve us best. Thank you. – DeepFriedBits Feb 27 '13 at 15:39
you're welcome :) – Aboodred1 Feb 27 '13 at 16:18

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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