Reverse proxy caching and user specific information

i am trying to cache a few pages with reverse proxy (using etags) and
though the content across these pages remain the same for all users,
there are some areas (like a div showing the user’s image username,
profile link in navbar) that are user specific.

What’s the best way to be able to cache these kind of pages using
reverse proxies but not still be able to differentiate the user
specific portions? What do the facebooks of the world do?

Thanks

I think they use JavaScript to inject the current user content into an
otherwise static page. Cache the bulk of the page, including all the
JavaScript, then use a very targeted XHR to replace one or two small
elements. It’s still multiple requests, but the size differential
between cached and un-cached content is very large. Plus the outer
page loads immediately, then updates to include the custom stuff.

Set the session to carry the user’s id, then ask the session who
requested this XHR before returning the custom results and using
static JavaScript to update that area. If I recall correctly, there is
a Railscast about this very solution.

Walter

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs