How do you cache web pages with a personalized header using caching reverse proxy such as Squid, Var

Posted by Continuation on Server Fault See other posts from Server Fault or by Continuation
Published on 2010-04-08T13:11:32Z Indexed on 2010/04/08 13:13 UTC
Read the original article Hit count: 406

Filed under:
|
|
|
|

Pretty much every page of my website is dynamically generated. However they don't change that frequently (kinda similar to a forum page). So I'd like to cache them using a caching reverse proxy such as Squid, varnish or Nginx.

The problem is that for my logged-in users, each of them will see a personalized header saying "Welcome John Doe. Logout" on the upper right corner of the page (just like serverfault). While users who aren't logged in will see a header that says "Login" instead.

So basically even though every user will see the same page in general, they all slightly different version due to that personalized header.

Is there any way so that I can cache the "main" part of the page and serve it from cache while generate the personalized header dynamically for each individual user?

This must be a very common problem. How is it solved in general?

© Server Fault or respective owner

Related posts about cache

Related posts about reverse-proxy