<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Vcl on Varnish Cache</title><link>https://www.varnish.org/docs/tutorials/tags/vcl/</link><description>Recent content in Vcl on Varnish Cache</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 29 May 2024 00:00:00 +0000</lastBuildDate><atom:link href="https://www.varnish.org/docs/tutorials/tags/vcl/index.xml" rel="self" type="application/rss+xml"/><item><title>VSL cheatsheet</title><link>https://www.varnish.org/docs/tutorials/vsl-cheatsheet/</link><pubDate>Wed, 29 May 2024 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/vsl-cheatsheet/</guid><description>&lt;p&gt;This page explains a few options common to VSL tools and provides ready-to-use VSL queries to simplify the first steps around the
Varnish Shared Log.&lt;/p&gt;
&lt;h2 id="concepts"&gt;Concepts&lt;/h2&gt;
&lt;p&gt;For performance reasons, Varnish doesn&amp;rsquo;t write log files. Instead, it outputs
them in an in-memory circular buffer. Other processes can then read this buffer
and decide what to do with the information.&lt;/p&gt;
&lt;p&gt;This translates into a few points:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;logging is extremely fast and doesn&amp;rsquo;t slow down the main process&lt;/li&gt;
&lt;li&gt;this allows you to log a great deal of data for each transaction&lt;/li&gt;
&lt;li&gt;another tool is needed to collect/process the logs&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="varnishlog"&gt;varnishlog&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;varnishlog&lt;/code&gt; is not the tool you want to collect logs to store. However, it is the
perfect choice to obtain debugging data thanks to the vast amount of data
it produces.&lt;/p&gt;</description></item><item><title>Mixed content and ERR_TOO_MANY_REDIRECTS errors in WordPress when using Varnish</title><link>https://www.varnish.org/docs/tutorials/mixed-content-err-too-many-redirects-wordpress-varnish/</link><pubDate>Tue, 05 Dec 2023 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/mixed-content-err-too-many-redirects-wordpress-varnish/</guid><description>&lt;p&gt;If you’re running a &lt;a href="https://www.varnish.org/"&gt;WordPress&lt;/a&gt; site and use Varnish without TLS support, there are 2 typical issues you may encounter when it comes to offloading TLS: &lt;em&gt;mixed content&lt;/em&gt; and the dreaded &lt;code&gt;ERR_TOO_MANY_REDIRECTS&lt;/code&gt; error. Both issues are related to a lack of TLS awareness in the stack.&lt;/p&gt;
&lt;p&gt;This tutorial will show you how to tackle both issues and how to create TLS awareness in a situation where both WordPress and Varnish might be lacking that awareness.&lt;/p&gt;</description></item><item><title>Bypassing the cache for specific URL patterns</title><link>https://www.varnish.org/docs/tutorials/bypass-cache-urls/</link><pubDate>Tue, 21 Sep 2021 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/bypass-cache-urls/</guid><description>&lt;p&gt;Bypassing the cache in Varnish is done by calling &lt;code&gt;return (pass)&lt;/code&gt; in the &lt;code&gt;vcl_recv&lt;/code&gt; subroutine of your VCL file. This return statement will send you to the &lt;code&gt;vcl_pass&lt;/code&gt; subroutine where a backend fetch will be triggered instead of performing a cache lookup.&lt;/p&gt;
&lt;p&gt;This is something you would typically do when you can determine, based on the request information, that the response is not cacheable.&lt;/p&gt;
&lt;p&gt;A typical example is using the URL to identify non-cacheable resources.&lt;/p&gt;</description></item><item><title>Performing HTTP redirections in Varnish</title><link>https://www.varnish.org/docs/tutorials/redirect/</link><pubDate>Mon, 13 Sep 2021 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/redirect/</guid><description>&lt;p&gt;Varnish can perform HTTP redirections by returning a &lt;em&gt;synthetic&lt;/em&gt; &lt;code&gt;HTTP 301&lt;/code&gt; response containing a &lt;code&gt;Location&lt;/code&gt; header with the redirection endpoint.&lt;/p&gt;
&lt;p&gt;Synthetic responses are triggered by a &lt;code&gt;return (synth())&lt;/code&gt; statement called from a client-side VCL subroutine. This also requires extending the &lt;code&gt;vcl_synth&lt;/code&gt; logic and adding the necessary redirection logic.&lt;/p&gt;
&lt;h2 id="http-to-https-redirections"&gt;HTTP to HTTPS redirections&lt;/h2&gt;
&lt;p&gt;One of the most common types of HTTP redirection is HTTP to HTTPS.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s an example where an HTTP request is redirected to its HTTPS equivalent:&lt;/p&gt;</description></item><item><title>Using multiple backends in Varnish</title><link>https://www.varnish.org/docs/tutorials/multiple-backends/</link><pubDate>Thu, 02 Sep 2021 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/multiple-backends/</guid><description>&lt;p&gt;The most common Varnish setups will feature a single backend, as illustrated in the VCL snippet below:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-vcl" data-lang="vcl"&gt;vcl 4.1;

backend default {
 .host = &amp;#34;127.0.0.1&amp;#34;;
 .port = &amp;#34;8080&amp;#34;;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;However it is also possible to define multiple backends and to use VCL logic to decide which backend to use.&lt;/p&gt;
&lt;h2 id="vcl-example"&gt;VCL example&lt;/h2&gt;
&lt;p&gt;The example below has 2 backends:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;default&lt;/code&gt; that connects to &lt;code&gt;backend.example.com&lt;/code&gt; on port &lt;code&gt;80&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;image&lt;/code&gt; that connects to &lt;code&gt;image.example.com&lt;/code&gt; on port &lt;code&gt;80&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;image&lt;/code&gt; backend in the example is only used when the URL ends with &lt;code&gt;.png&lt;/code&gt;, &lt;code&gt;.jpg&lt;/code&gt; or &lt;code&gt;.svg&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Banning content from Varnish</title><link>https://www.varnish.org/docs/tutorials/ban/</link><pubDate>Tue, 31 Aug 2021 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/ban/</guid><description>&lt;p&gt;&lt;em&gt;Banning&lt;/em&gt; is a concept in &lt;em&gt;Varnish&lt;/em&gt; that allows &lt;em&gt;expression-based cache invalidation&lt;/em&gt;. This means that you can invalidate multiple objects from the cache without the need for individual &lt;a href="https://www.varnish.org/docs/tutorials/purge/"&gt;purge&lt;/a&gt; calls.&lt;/p&gt;
&lt;p&gt;A &lt;em&gt;ban&lt;/em&gt; is created by adding a &lt;em&gt;ban expression&lt;/em&gt; to the &lt;em&gt;ban list&lt;/em&gt;. All objects in the cache will be evaluated against the expressions in the &lt;em&gt;ban list&lt;/em&gt; before being served. If the object is banned Varnish will mark it as expired and fetch new content from the backend.&lt;/p&gt;</description></item><item><title>Purging content from Varnish</title><link>https://www.varnish.org/docs/tutorials/purge/</link><pubDate>Mon, 30 Aug 2021 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/purge/</guid><description>&lt;p&gt;The most basic and easy-to-use &lt;em&gt;cache invalidation mechanism&lt;/em&gt; in Varnish is &lt;em&gt;purging&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;The idea is that you can perform a &lt;code&gt;return (purge)&lt;/code&gt; in &lt;code&gt;vcl_recv&lt;/code&gt;, and &lt;em&gt;Varnish&lt;/em&gt; will remove the object. This would free up space in the cache after an object lookup.&lt;/p&gt;
&lt;p&gt;This means that the &lt;em&gt;hash&lt;/em&gt; of the object is used to identify it, but &lt;code&gt;return (purge)&lt;/code&gt; would remove it along with its variants. This isn&amp;rsquo;t &lt;em&gt;out-of-the-box&lt;/em&gt; behavior; you won&amp;rsquo;t find it in the &lt;em&gt;built-in VCL&lt;/em&gt;. You need to write some VCL code for it.&lt;/p&gt;</description></item><item><title>Configuring Varnish for Drupal</title><link>https://www.varnish.org/docs/tutorials/configuring-varnish-drupal/</link><pubDate>Mon, 09 Aug 2021 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/configuring-varnish-drupal/</guid><description>&lt;p&gt;Drupal is an open-source content management framework that is popular for mid-market and enterprise solutions that require more complex content types and workflows.&lt;/p&gt;
&lt;p&gt;This tutorial is a step-by-step guide on how to configure Varnish for Drupal.&lt;/p&gt;

&lt;div class="alert callout alert-info my-4" role="alert"&gt;This tutorial features &lt;em&gt;Drupal 9&lt;/em&gt; and &lt;em&gt;Varnish 9&lt;/em&gt;.&lt;/div&gt;
&lt;h2 id="1-install-and-configure-varnish"&gt;1. Install and configure Varnish&lt;/h2&gt;
&lt;p&gt;If you are already running a Drupal CMS and you want to use Varnish to accelerate it, you&amp;rsquo;ll have to decide where to install Varnish:&lt;/p&gt;</description></item><item><title>Configuring Varnish for Magento</title><link>https://www.varnish.org/docs/tutorials/configuring-varnish-magento/</link><pubDate>Mon, 09 Aug 2021 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/configuring-varnish-magento/</guid><description>&lt;p&gt;Magento is one of the most popular e-commerce platforms out there and has both a &lt;em&gt;Community Edition&lt;/em&gt; and an &lt;em&gt;Enterprise Edition&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Magento is very flexible and versatile and that comes at a cost: the performance of a Magento store with lots of products and lots of visitors is often quite poor without a decent caching layer.&lt;/p&gt;
&lt;p&gt;Luckily Magento has built-in caching mechanisms and the &lt;em&gt;full page cache&lt;/em&gt; system has native support for Varnish.&lt;/p&gt;</description></item><item><title>Configuring Varnish for WordPress</title><link>https://www.varnish.org/docs/tutorials/configuring-varnish-wordpress/</link><pubDate>Mon, 09 Aug 2021 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/configuring-varnish-wordpress/</guid><description>&lt;p&gt;WordPress is by far the most popular content management system on the internet. It is no longer exclusively used for simple blogs, but serves as the foundation of many popular websites.&lt;/p&gt;
&lt;p&gt;In order to maintain the desired performance under heavy load, a solid caching strategy is a must. And that&amp;rsquo;s where Varnish truly shines.&lt;/p&gt;
&lt;p&gt;In this tutorial we&amp;rsquo;ll explain how to install and configure Varnish on your WordPress site.&lt;/p&gt;
&lt;h2 id="1-install-and-configure-varnish"&gt;1. Install and configure Varnish&lt;/h2&gt;
&lt;p&gt;If you are already running WordPress in production, and you&amp;rsquo;re looking to accelerate the website with Varnish, you&amp;rsquo;ll have to decide where to install Varnish:&lt;/p&gt;</description></item><item><title>Example VCL template</title><link>https://www.varnish.org/docs/tutorials/example-vcl-template/</link><pubDate>Mon, 09 Aug 2021 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/example-vcl-template/</guid><description>&lt;p&gt;Varnish&amp;rsquo;s built-in VCL is very conservative and focuses on not caching stateful and personalized content. By following the HTTP standard for caching rules, Varnish is &lt;em&gt;safe by default&lt;/em&gt;. Unfortunately, in many real-life situations where backend servers do not send good caching headers, this will result in a low hit rate.&lt;/p&gt;
&lt;p&gt;In this tutorial we&amp;rsquo;ll present a collection of customizable VCL examples for Varnish. We&amp;rsquo;ll focus on the individual VCL template features and in the end we&amp;rsquo;ll bring it all together into a single VCL file.&lt;/p&gt;</description></item><item><title>Caching POST requests in Varnish</title><link>https://www.varnish.org/docs/tutorials/caching-post-requests-varnish/</link><pubDate>Fri, 17 May 2024 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/caching-post-requests-varnish/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;When a client (web browser) wants a regular resource (e.g., an HTML document or an image) from a web server, it will make a &lt;code&gt;GET&lt;/code&gt; request to the server. In a default installation, Varnish will cache such requests, and this will lessen the load on the conventional web server.&lt;/p&gt;
&lt;p&gt;When a user logs in to a site, or provides some unique or private information, this will be done through a &lt;code&gt;POST&lt;/code&gt; request. By default, Varnish will not cache &lt;code&gt;POST&lt;/code&gt; requests, but pass them directly to the backend server, unmodified. This is typically a good idea, but sometimes it makes sense to also cache POST requests.&lt;/p&gt;</description></item><item><title>Logging cache hits and misses</title><link>https://www.varnish.org/docs/tutorials/logging-cache-hits-misses-varnish/</link><pubDate>Thu, 28 Mar 2024 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/logging-cache-hits-misses-varnish/</guid><description>&lt;p&gt;One of the first things you&amp;rsquo;ll want to know about your Varnish setup is whether or
not your content is cached. In this tutorial, we&amp;rsquo;ll provide a VCL snippet and explain how to leverage it via &lt;code&gt;varnishlog&lt;/code&gt; and &lt;code&gt;varnishncsa&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="vcl"&gt;VCL&lt;/h2&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-vcl" data-lang="vcl"&gt;sub vcl_recv {
	unset req.http.x-cache;
}

sub vcl_hit {
	set req.http.x-cache = &amp;#34;hit&amp;#34;;
	if (obj.ttl &amp;lt;= 0s &amp;amp;&amp;amp; obj.grace &amp;gt; 0s) {
		set req.http.x-cache = &amp;#34;hit graced&amp;#34;;
	}
}

sub vcl_miss {
	set req.http.x-cache = &amp;#34;miss&amp;#34;;
}

sub vcl_pass {
	set req.http.x-cache = &amp;#34;pass&amp;#34;;
}

sub vcl_pipe {
	set req.http.x-cache = &amp;#34;pipe uncacheable&amp;#34;;
}

sub vcl_synth {
	set req.http.x-cache = &amp;#34;synth synth&amp;#34;;
	# uncomment the following line to show the information in the response
	# set resp.http.x-cache = req.http.x-cache;
}

sub vcl_deliver {
	if (obj.uncacheable) {
		set req.http.x-cache = req.http.x-cache + &amp;#34; uncacheable&amp;#34; ;
	} else {
		set req.http.x-cache = req.http.x-cache + &amp;#34; cached&amp;#34; ;
	}
	# uncomment the following line to show the information in the response
	# set resp.http.x-cache = req.http.x-cache;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;x-cache&lt;/code&gt; header is where we store the information using two terms that
cover slightly different aspects of the content.&lt;/p&gt;</description></item><item><title>Avoiding HTTP to HTTPS redirect loops in Varnish</title><link>https://www.varnish.org/docs/tutorials/avoid-http-to-https-redirect-loops-varnish/</link><pubDate>Tue, 22 Mar 2022 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/avoid-http-to-https-redirect-loops-varnish/</guid><description>&lt;p&gt;When your force HTTP to HTTPS redirection in your web server or web application and cache the output, you might get stuck in a redirect loop. Your browser may present the following error message as a result:&lt;/p&gt;
&lt;p&gt;&lt;img
 src="https://www.varnish.org/images/tutorials/redirect-loop-browser-error.jpg"
 alt="Redirect loop error message"
 class="standalone-image"
/&gt;&lt;/p&gt;
&lt;p&gt;Behind the scenes, your browser will receive a &lt;code&gt;301 Moved Permanently&lt;/code&gt; status code and your browser will follow the URL from the &lt;code&gt;Location&lt;/code&gt; header:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-http" data-lang="http"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#cf222e"&gt;HTTP&lt;/span&gt;&lt;span style="color:#0550ae"&gt;/&lt;/span&gt;&lt;span style="color:#0550ae"&gt;1.1&lt;/span&gt; &lt;span style="color:#0550ae"&gt;301&lt;/span&gt; Moved Permanently
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Location&lt;span style="color:#0550ae"&gt;:&lt;/span&gt; https://example.com/
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Content-Length&lt;span style="color:#0550ae"&gt;:&lt;/span&gt; 226
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Content-Type&lt;span style="color:#0550ae"&gt;:&lt;/span&gt; text/html; charset=iso-8859-1
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;X-Varnish&lt;span style="color:#0550ae"&gt;:&lt;/span&gt; 2
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Age&lt;span style="color:#0550ae"&gt;:&lt;/span&gt; 0
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Via&lt;span style="color:#0550ae"&gt;:&lt;/span&gt; 1.1 varnish
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Despite using an &lt;code&gt;https://&lt;/code&gt; URI scheme, the origin server will continue to issue redirects and you&amp;rsquo;re in fact stuck in a redirect loop. This loop continues until your browser gives up, at which point the error message will appear.&lt;/p&gt;</description></item><item><title>Varnish Configuration Language (VCL)</title><link>https://www.varnish.org/docs/tutorials/varnish-configuration-language-vcl/</link><pubDate>Thu, 16 Dec 2021 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/varnish-configuration-language-vcl/</guid><description>&lt;p&gt;The &lt;em&gt;Varnish Configuration Language (VCL)&lt;/em&gt; is a domain-specific programming language used by Varnish to control request handling, routing, caching, and several other aspects.&lt;/p&gt;
&lt;p&gt;At first glance, VCL looks a lot like a normal, top-down programming language, with subroutines, if-statements and function calls. However, it is impossible to execute VCL outside of Varnish. Instead, you write code that is run inside Varnish at specific stages of the request-handling process. This lets you define advanced logic that extends the default behavior of Varnish.&lt;/p&gt;</description></item><item><title>Load a synthetic output template from a file</title><link>https://www.varnish.org/docs/tutorials/vcl-synthetic-output-template-file/</link><pubDate>Tue, 05 Oct 2021 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/vcl-synthetic-output-template-file/</guid><description>&lt;p&gt;In this tutorial we will override the VCL output template for &lt;code&gt;vcl_synth&lt;/code&gt; and &lt;code&gt;vcl_backend_error&lt;/code&gt; by loading it from a file.&lt;/p&gt;
&lt;p&gt;These subroutines are used to compose the output when synthetic responses are returned. These are responses that do not originate from the origin server. When you trigger a synthetic response yourself, you end up in the &lt;code&gt;vcl_synth&lt;/code&gt; subroutine. When the synthetic response is the result of a failed backend response, you end up in &lt;code&gt;vcl_backend_error&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Varnish built-in VCL</title><link>https://www.varnish.org/docs/tutorials/varnish-builtin-vcl/</link><pubDate>Tue, 05 Oct 2021 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/varnish-builtin-vcl/</guid><description>&lt;p&gt;The built-in VCL contains a set of rules that will be executed by default, even if they are not specified in your own VCL file. It is possible to bypass the built-in VCL by issuing a &lt;code&gt;return&lt;/code&gt; statement in your VCL code.&lt;/p&gt;
&lt;p&gt;The built-in VCL provides much of the &lt;em&gt;safe-by-default&lt;/em&gt; behavior of Varnish, so be very careful if you decide to skip it.&lt;/p&gt;
&lt;p&gt;The built-in VCL defines the behavior for various states of the &lt;em&gt;Varnish Finite State Machine&lt;/em&gt;, each of which comes with its own subroutine. This tutorial will explain what the behavior in each of these subroutines means.&lt;/p&gt;</description></item><item><title>Using basic authentication in VCL backend probes</title><link>https://www.varnish.org/docs/tutorials/vcl-backend-probe-basic-authentication/</link><pubDate>Fri, 01 Oct 2021 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/vcl-backend-probe-basic-authentication/</guid><description>&lt;p&gt;When your Varnish server proxies requests to a backend that requires authorized access via &lt;em&gt;basic authentication&lt;/em&gt;, you need to ensure that the right &lt;code&gt;Authorization&lt;/code&gt; header is sent for each probe request.&lt;/p&gt;
&lt;h2 id="1-initial-situation"&gt;1. Initial situation&lt;/h2&gt;
&lt;p&gt;Your initial backend setup will have a backend that may contain a &lt;code&gt;.probe {}&lt;/code&gt; definition.&lt;/p&gt;
&lt;p&gt;This health-checking probe will send HTTP requests to your backend server at regular intervals. As long as a &lt;code&gt;200&lt;/code&gt; status code is returned, the backend is considered healthy.&lt;/p&gt;</description></item><item><title>Cache invalidation</title><link>https://www.varnish.org/docs/tutorials/cache-invalidation/</link><pubDate>Wed, 20 May 2020 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/cache-invalidation/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;A good caching strategy not only defines how the content should be cached, but most importantly, how it should be invalidated and evicted from cache.
An object inserted in cache can be served to other clients until it expires, is evicted to make room for other objects, or is invalidated.&lt;/p&gt;
&lt;p&gt;The TTL (Time to Live) of an object define how long an object can be cached. An object&amp;rsquo;s TTL is set when the content is generated (by the backend) or when it&amp;rsquo;s inserted (in Varnish).
The TTL can be set via HTTP caching headers (i.e. &lt;code&gt;Expires&lt;/code&gt; or &lt;code&gt;Cache-Control&lt;/code&gt;) or via VCL.
Either way, Varnish will respect the defined TTLs and evict the object when its Time to Live has expired, making room for fresher content to be inserted in cache.&lt;/p&gt;</description></item><item><title>Object lifetimes: TTL, Grace, Keep</title><link>https://www.varnish.org/docs/tutorials/object-lifetimes/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.varnish.org/docs/tutorials/object-lifetimes/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;If you landed on this page it is very likely that you are familiar with Varnish and you know it improves content delivery performance
by storing a copy of your content in cache, and every request thereafter is fulfilled by cached content.
Every copy of the content (&lt;em&gt;aka object&lt;/em&gt;) stored in cache has a lifetime that defines how long an object can be considered fresh,
or live, within the cache.&lt;/p&gt;</description></item></channel></rss>