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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Walter Lee Davis
2010-Oct-19 17:30 UTC
Re: reverse proxy caching and user specific information
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 On Oct 19, 2010, at 1:04 PM, badnaam wrote:> 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 > > -- > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails- > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en > . >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.