1

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 Feb 26 '13 at 23:17
  • Yes, that's certainly an option for us. – DeepFriedBits Feb 27 '13 at 7:52
0

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);
          break;
      }
    }

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). – 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
0

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, privacy policy and cookie policy

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