[執筆:Konstantin G]{class="badge informative" title="コンスタンチン G."}
ワニス ESI ブロック
エッジサイドインクルード(ESI)は、web ページを他の web ページに含めるために使用できる特別なディレクティブです。
例:
<div>
<esi:include src="http://domain.com/index.php/page_cache/block/esi/blocks"/>
</div>
ワニスは次の場所からコンテンツを取得します http://domain.com/index.php/page_cache/block/esi/blocks
を作成して、 <esi>
これでタグ付けします。
Commerceとワニス ESI
次の条件を満たすと、Commerce フレームワークによって ESI タグが作成されます。
- キャッシュアプリケーションはに設定されます
Varnish Cache
- XML レイアウト
block
要素がで追加されるttl
属性
例
cms_index_index.xml
:
<referenceContainer name="content">
<block class="Magento\Framework\View\Element\Template" template="Magento_Paypal::esi.phtml" ttl="30"/>
</referenceContainer>
上記の例では、 block
要素が次からコンテンツを追加 esi.phtml
ホームページおよび Varnish へのテンプレートは、30 秒ごとに自動的に更新されます。
制限事項
現在、Varnish は HTTPS 上の ESI をサポートしていないので、自動的に HTTP に切り替わります。
Magento\PageCache\Observer\ProcessLayoutRenderElement
:
private function _wrapEsi(
\Magento\Framework\View\Element\AbstractBlock $block,
\Magento\Framework\View\Layout $layout
) {
....
// Varnish does not support ESI over HTTPS must change to HTTP
$url = substr($url, 0, 5) === 'https' ? 'http' . substr($url, 5) : $url;
return sprintf('<esi:include src="%s" />', $url);
}
recommendation-more-help
386822bd-e32c-40a8-81c2-ed90ad1e198c