diff --git a/TECHNICAL_NOTES.md b/TECHNICAL_NOTES.md index c885b0f6b..5408b8bd5 100644 --- a/TECHNICAL_NOTES.md +++ b/TECHNICAL_NOTES.md @@ -23,7 +23,7 @@ ESI was originally created so that CDN providers (like Akamai) could serve their However, actually implementing ESI in Magento is horrendously complicated as Magento doesn't seem to have been designed with rendering just a single block, rather than an entire page, which is needed to serve the actual ESI requests from Varnish. Luckily, Hugues Alary did most of the hard work and made it available in his [Magento-Varnish](https://github.com/huguesalary/Magento-Varnish) extension. The core of how both Magento-Varnish and Turpentine work is: 1. The extension has a [layout file](https://github.com/nexcess/magento-turpentine/blob/master/app/design/frontend/base/default/layout/turpentine_esi.xml) that tells the extension which blocks should be included via ESI. - 2. The extension waits for the [`core_block_abstract_to_html_before`](https://github.com/nexcess/magento-turpentine/blob/master/app/code/community/Nexcessnet/Turpentine/etc/config.xml#L228) event to trigger during a request, then [examines the block](https://github.com/nexcess/magento-turpentine/blob/master/app/code/community/Nexcessnet/Turpentine/Model/Observer/Esi.php#L191) the event was fired for and checks whether the block should be included via ESI based on the layout file. + 2. The extension waits for the [`core_block_abstract_to_html_before`](https://github.com/nexcess/magento-turpentine/blob/master/app/code/community/Nexcessnet/Turpentine/etc/config.xml#L228) event to trigger during a request, then [examines the block](https://github.com/nexcess/magento-turpentine/blob/master/app/code/community/Nexcessnet/Turpentine/Model/Observer/Esi.php#L220) the event was fired for and checks whether the block should be included via ESI based on the layout file. 3. If the block should be ESI included, the block's normal template is replaced by a [special template](https://github.com/nexcess/magento-turpentine/blob/master/app/design/frontend/base/default/template/turpentine/esi.phtml) with the ESI include tag that signals Varnish to instead pull the block's content from a separate request. A flag is also added to the request to signal to Varnish that the request should have ESI processing run on it. 4. The response finishes and is sent to Varnish, Varnish sees the ESI flag and sends a request to get the ESI content, which is then [rendered](https://github.com/nexcess/magento-turpentine/blob/master/app/code/community/Nexcessnet/Turpentine/controllers/EsiController.php#L58) and sent back to Varnish to be included in the original response.