Solutions to annoying CDN behaviors

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by mshmsh5000 on February 28, 2011 at 10:03pm

In our stable of D6/PF6 publishing sites, several have these qualities in common:

  • Delivered by Akamai.
  • /admin and other sensitive paths are locked out of the public site (example.com/admin) and available only on our internal network (e.g., internal.example.com/admin).
  • Cookies are shared on the domain level (.example.com).
  • admin_menu enabled.
  • Akamai is set to ignore the app's cache-control headers in certain places, or across the whole site.

Re: the last bullet, you might say, "Ack! Why do that?" The reasons are various, but often have to do with supporting legacy aspects of the site.

In any case, one common problem is this:

  • Editor logs in on internal site.
  • Editor updates content.
  • Editor loads updated page in Akamaized (public) site.

This can lead to this unfortunate situation:

  • Edge server has no cache for the page; passes request back to app server.
  • Drupal sees that user has perms to view the admin menu, so renders it.
  • Admin menu is cached in this edge server's cache.

The immediate answer was to create an add-on module for admin_menu that allows path-based control of the display:

https://github.com/mshmsh5000/admin_menu_path

But when I added this to the issue queue for admin_menu, sun's reaction was that I just needed to fix the CDN config, not the module.

Your configuration/logic for caching pages is wrong then. If the cached page shouldn't contain the admin menu, then you should not cache pages generated for privileged users that have access to admin menu.

So, two questions for the community:

  • Do you see another way around this problem, given that I can't always change the CDN config to honor cache-control headers?
  • Any other stories to share about annoying CDN-related problems (not necessarily the fault of the CDN, of course)? I spend a good percentage of almost every day dealing with cache-control issues, so I'm curious.
Categories:

Comments

2 modules for other issues

Posted by mikeytown2 on February 28, 2011 at 10:23pm

I have 2 modules being developed to deal with 2 issues that I've encountered with JS/CSS aggregated files and imagecache files.
http://drupal.org/project/imageinfo_cache - I should move this to a 1.0 stable release as I haven't encountered any issues with it now. Only feature request.
http://drupal.org/project/advagg - Still under active development; testing is greatly appreciated.

That's an interesting issue you have there. What happens when the rendered page contains a Drupal message? That would be another edge case to look into. You could try something like http://drupal.org/project/purl to do a path prefix for privileged users. That way the URL structure is different and thus won't get served out. Another thing to try is setting a header and having the edge servers not cache if that header is there.

advagg

Posted by mshmsh5000 on March 1, 2011 at 4:54pm

advagg is awesome -- been testing locally, just submitted my first bug report. Thanks for the great work on this so far. Will solve problems on many apps when it's ready for prime time. I plan to do some testing in an Akamaized environment soon, should have more results after Drupalcon.

As for Drupal messages, not an issue here -- they're generally hidden in the main theme on the two sites that display the cached admin menu problem.

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /