<div dir="ltr"><div>Hi Ricardo,</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.</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.</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).</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></div><div><br></div><div>Kind regards,</div><div><br></div><div><br></div><div><br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div><div>Guillaume Quintard<br></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">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 class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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"><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>_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>