<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>index on Varnish Cache</title><link>https://example.org/docs/vcl-design-patterns/</link><description>Recent content in index on Varnish Cache</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 07 Sep 2021 00:00:00 +0000</lastBuildDate><atom:link href="https://example.org/docs/vcl-design-patterns/index.xml" rel="self" type="application/rss+xml"/><item><title>Ignoring the Vary header for bots</title><link>https://example.org/docs/vcl-design-patterns/ignoring-the-vary-header-for-bots/</link><pubDate>Tue, 07 Sep 2021 00:00:00 +0000</pubDate><guid>https://example.org/docs/vcl-design-patterns/ignoring-the-vary-header-for-bots/</guid><description>&lt;p&gt;Varnish supports HTTP variants out of the box, but the &lt;em&gt;Vary&lt;/em&gt; header is
somewhat limited since it operates on complete header values. If you want for
example to conduct an A/B testing campaign or perform blue/green deployment
you can make clients &amp;ldquo;remember&amp;rdquo; their path with a first-party cookie.&lt;/p&gt;
&lt;p&gt;When a search engine bot asks for contents however, there&amp;rsquo;s a high chance that
they don&amp;rsquo;t process cookies and in all likelihood you would prefer to serve a
response quickly. In that case you would probably prefer not to even try to
attribute a category to the client, but in that case you create a new variant
in your cache that is none of A, B, blue, green, or whatever your backend
serves.&lt;/p&gt;</description></item><item><title>Using extra digits in resp.status</title><link>https://example.org/docs/vcl-design-patterns/using-extra-digits-in-resp-status/</link><pubDate>Tue, 07 Sep 2021 00:00:00 +0000</pubDate><guid>https://example.org/docs/vcl-design-patterns/using-extra-digits-in-resp-status/</guid><description>&lt;p&gt;In Varnish the &lt;code&gt;.status&lt;/code&gt; variables can hold more than three
digits, which is useful to send information to &lt;code&gt;vcl_synth{}&lt;/code&gt;
about which error message to produce:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sub vcl_recv {
 if ([...]) {
 return(synth(12404));
 }
}

sub vcl_synth {
 if (resp.status == 12404) {
 [...] // this specific 404
 } else if (resp.status % 1000 == 404) {
 [...] // all other 404's
 }
}
&lt;/code&gt;&lt;/pre&gt;</description></item></channel></rss>