<html><head></head><body><div style="color:black;font-size:14px">Hello Guillaume.<br></div><div style="color: black;font-size: 14px;">Thanks for your answer.<br></div><div style="color: black;font-size: 14px;">The VCL is actually almost identical to that you mentioned in the link (I'm attaching it without references to names and IP anyway)<br></div><div style="color: black;font-size: 14px;"><br></div><div style="color: black;font-size: 14px;">What somehow worries me is that, if I understand, the ban is performed according to some "X-Magento-Tags".<br></div><div style="color: black;font-size: 14px;">Now, if I look at the output of varnishlog and search for "*Tags*", what I get is:<br></div><div style="color: black;font-size: 14px;"><br></div><div style="color: black;font-size: 14px;">1) while navigating the site:<br></div><blockquote style="border-left: 2px solid rgb(168, 168, 168); padding-left: 10px; margin-top: 0.5rem; margin-block-start: 0px; margin-inline-start: 0px;"><div style="color: black;font-size: 14px;">....<br></div><div style="color: black;font-size: 14px;">- RespHeader X-Magento-Tags: NAVIGATIONPRO_MENU_2<br></div><div style="color: black;font-size: 14px;">- RespUnset X-Magento-Tags: NAVIGATIONPRO_MENU_2<br></div><div style="color: black;font-size: 14px;">- RespHeader X-Magento-Tags: store,cms_b,gdpr_c,theme_editor_backend_css_block,cms_b_header_cms_links,cms_b_argento_scroll_up,cms_b_footer_cms_content,cms_b_footer_payments,cms_b_header_block_custom_links,cms_b_main_bottom_newsletter,cms_b_main_bottom_strenghts,cms_b<br></div><div style="color: black;font-size: 14px;">- RespUnset X-Magento-Tags: store,cms_b,gdpr_c,theme_editor_backend_css_block,cms_b_header_cms_links,cms_b_argento_scroll_up,cms_b_footer_cms_content,cms_b_footer_payments,cms_b_header_block_custom_links,cms_b_main_bottom_newsletter,cms_b_main_bottom_strenghts,cms_b<br></div><div style="color: black;font-size: 14px;">- BerespHeader X-Magento-Tags: cat_c_595,cat_c_p_595,store,cms_b,gdpr_c,theme_editor_backend_css_block,cms_b_header_cms_links,cms_b_argento_scroll_up,cms_b_footer_cms_content,cms_b_footer_payments,cms_b_header_block_custom_links,cms_b_main_bottom_newsletter,cms_b_main_<br></div><div style="color: black;font-size: 14px;">- BerespHeader X-Magento-Tags: NAVIGATIONPRO_MENU_2<br></div><div style="color: black;font-size: 14px;">- RespHeader X-Magento-Tags: NAVIGATIONPRO_MENU_2<br></div><div style="color: black;font-size: 14px;">- RespUnset X-Magento-Tags: NAVIGATIONPRO_MENU_2<br></div><div style="color: black;font-size: 14px;">- RespHeader X-Magento-Tags: cat_c_595,cat_c_p_595,store,cms_b,gdpr_c,theme_editor_backend_css_block,cms_b_header_cms_links,cms_b_argento_scroll_up,cms_b_footer_cms_content,cms_b_footer_payments,cms_b_header_block_custom_links,cms_b_main_bottom_newsletter,cms_b_main_<br></div><div style="color: black;font-size: 14px;">- RespUnset X-Magento-Tags: cat_c_595,cat_c_p_595,store,cms_b,gdpr_c,theme_editor_backend_css_block,cms_b_header_cms_links,cms_b_argento_scroll_up,cms_b_footer_cms_content,cms_b_footer_payments,cms_b_header_block_custom_links,cms_b_main_bottom_newsletter,cms_b_main_<br></div><div style="color: black;font-size: 14px;">.....<br></div></blockquote><div style="color: black;font-size: 14px;">2) when performing a purge (php bin/magento c:f):<br></div><blockquote style="border-left: 2px solid rgb(168, 168, 168); padding-left: 10px; margin-top: 0.5rem; margin-block-start: 0px; margin-inline-start: 0px;"><div style="color: black;font-size: 14px;">...<br></div><div style="color: black;font-size: 14px;">- ReqHeader X-Magento-Tags-Pattern: .*<br></div><div style="color: black;font-size: 14px;">...<br></div></blockquote><div style="color: black;font-size: 14px;">In both cases I can't see any specific reference to that particular site.</div><div style="color:black;font-size:14px" class="signature"><br></div><div style="color: black;font-size: 14px;">Thanks again.<br></div><div style="color: black;font-size: 14px;">Riccardo</div><div><br></div><div>11/07/2023, 17:09 Guillaume Quintard ha scritto:<br></div><blockquote style="border-left: 2px solid rgb(168, 168, 168); margin-left: 0px; padding-left: 10px; margin-top: 0.5rem; margin-block-start: 0px; margin-inline-start: 0px;"><div class="qbox-body"><div dir="ltr"><div>Hi Ricardo,<br></div><div><br></div><div>Having your VCL (even anonymized) would help here, otherwise debugging is pretty hard. For the moment, I'm going to assume you are using a variation of <a href="https://github.com/magento/magento2/blob/13e54e1b28a5d590ab885bd4df9f58877b549052/app/code/Magento/PageCache/etc/varnish6.vcl">https://github.com/magento/magento2/blob/13e54e1b28a5d590ab885bd4df9f58877b549052/app/code/Magento/PageCache/etc/varnish6.vcl</a> and deal in generalities.<br></div><div><br></div><div>The way that vcl invalidates content is through bans: <a href="https://github.com/magento/magento2/blob/13e54e1b28a5d590ab885bd4df9f58877b549052/app/code/Magento/PageCache/etc/varnish6.vcl#L30-L47">https://github.com/magento/magento2/blob/13e54e1b28a5d590ab885bd4df9f58877b549052/app/code/Magento/PageCache/etc/varnish6.vcl#L30-L47</a> which doesn't need the host header, it's just uses unique tags pushed by the backend in response headers.<br></div><div>If it was using the actual purge mechanism, then modifying the host should be sufficient because purge acts on the object found in the cache (and if you can get a hit, you can get purged).<br></div><div><br></div><div>Here's a good primer on invalidation: <a href="https://docs.varnish-software.com/tutorials/cache-invalidation/">https://docs.varnish-software.com/tutorials/cache-invalidation/</a><br></div><div><br></div><div>Kind regards,<br></div><div><br></div><div><br></div><div><br></div><div><div><div data-smartmail="gmail_signature" class="gmail_signature" dir="ltr"><div dir="ltr"><div>-- <br></div><div>Guillaume Quintard<br></div></div></div></div><div><br></div></div></div><div><br></div><div class="gmail_quote"><div class="gmail_attr" dir="ltr">On Tue, Jul 11, 2023 at 4:14 AM Riccardo Brunetti <<a href="mailto:riccardo.brunetti@host.it">riccardo.brunetti@host.it</a>> wrote:<br></div><blockquote style="margin: 0.5rem 0px 0px 0.8ex; border-left: 2px solid rgb(168, 168, 168); padding-left: 10px; margin-block-start: 0px; margin-inline-start: 0px;" class="gmail_quote"><div><div style="color:black;font-size:14px">Hello.<br></div><div style="color:black;font-size:14px">I'm new to varnish and I have a question concerning how to manage multiple sites using the same varnish cache frontend.<br></div><div style="color:black;font-size:14px"><br></div><div style="color:black;font-size:14px">More specifically, I need to setup a single varnish cache server for two different Magento2 sites.<br></div><div style="color:black;font-size:14px"><br></div><div style="color:black;font-size:14px">Looking around I found that it is possible to manage different backends using something like:<br></div><div style="color:black;font-size:14px"><br></div><blockquote style="border-left: 2px solid rgb(168, 168, 168); padding-left: 10px; margin-top: 0.5rem; margin-block-start: 0px; margin-inline-start: 0px;"><div style="color:black;font-size:14px">if (req.http.host == "somesite") {<br></div><div style="color:black;font-size:14px"> set req.backend_hint = somebackend;<br></div><div style="color:black;font-size:14px"> }<br></div></blockquote><div style="color:black;font-size:14px">Now, I have two different Magento2 sites and, using the above expression, I can handle the two different backends.<br></div><div style="color:black;font-size:14px">The problem is that I can't understand how to handle the PURGE/BAN of the two independently.<br></div><div style="color:black;font-size:14px"><br></div><div style="color:black;font-size:14px">As far as I understand from the .vcl file that Magento2 itself produces there is nothing inside the "purge" section that specifies which resources must be purged.<br></div><div style="color:black;font-size:14px">It seems to me that is site A performs a purge, than also the cache of site B resources will be cleaned.<br></div><div style="color:black;font-size:14px"><br></div><div style="color:black;font-size:14px">Can you help me with this or point me to some example or tutorials?<br></div><div style="color:black;font-size:14px"><br></div><div style="color:black;font-size:14px">Thanks a lot<br></div><div style="color:black;font-size:14px">Riccardo <br></div></div><div>_______________________________________________<br></div><div> varnish-misc mailing list<br></div><div> <a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br></div><div> <a rel="noreferrer" href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br></div></blockquote></div></div></blockquote><div style="color: black;font-size: 14px;"><br></div></body></html>