Dynamic Page Display Behind a Proxy Cache

Posted Dec 22, 2010 // 0 comments
Josh:

Proxy caches like Varnish can help Drupal to perform and scale much better in certain situations. However, it can also limit your ability to interact with anonymous users. When using a proxy cache, it is still possible to serve dynamic pages to your anonymous users. Understanding the way that a proxy cache works is the first step to being able to use it effectively. Simply placing Varnish in front of a Drupal site will not necessarily fix everything.

Cookies are the only way to really store information about anonymous users but proxy caching generally doesn't serve cached pages when cookies are set. The first step then is ensuring that your proxy cache will ignore any cookies you set. Failure to do this will break your caching strategy. The second step is to create javascript that can parse the cookies you set. This javascript will be served with your cached page and see the cookies you have set.

This javascript can be used to parse which cookies are set and then set a cookie that will route the user past the cache. This cookie can then be immediately unset so that the anonymous user will get a cached page on their next request. By only showing one un-cached page to the user you can maintain a caching strategy while still showing some dynamic content to anonymous users.

About Josh

Web Developer Josh Caldwell specializes in pairing a beautiful, intuitive interface with a solid, well-designed backend product. His ability to identify open-source solutions and front-end capabilities allows him to write impressive, ...

more >

Read Josh's Blog

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <strong> <code> <p> <img> <ul> <ol> <li> <h2> <h3> <h4> <b> <u> <i>
  • You may insert videos with [video:URL]

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.