Skip to content

Commit

Permalink
Update TECHNICAL_NOTES.md
Browse files Browse the repository at this point in the history
Link correctly to the referenced `injectEsi` function.
  • Loading branch information
GLips committed Mar 23, 2016
1 parent 8b16505 commit 1c4fc54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion TECHNICAL_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 1c4fc54

Please sign in to comment.