Beginners question - how to avoid caching a specific section of a page

Comments

2 comments

  • Austin Spires

    @emm you're correct that single objects can't be segmented for different caching statuses without some additional work. ESI is one way to achieve this, but using an AJAX call or some other method of isolating the content in a separate HTTP call would work as well. The general rule is: with the exception of ESI handling, Fastly doesn't process web objects themselves -- we just read headers.

  • Rogier Mulhuijzen

    ESI comes with a few downsides as well:

    1. Currently Fastly does not support ESI with gzip. In some cases this is worth it, but it's definitely something to keep in mind.
    2. ESI with a fragment that is not cached means that we don't finish returning the page until after the origin responded. If you look at big websites like Facebook, they load the basic page first, and then update elements as they come in. This is a faster and more pleasant experience for most users. So using AJAX is better where it can be used.

    However, there definitely are use cases where AJAX is not usable, and in that case you'll have to make the gzip vs ESI tradeoff.

Please sign in to leave a comment.