⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.96
Server IP:
147.93.97.220
Server:
Linux srv843233 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
Server Software:
nginx/1.28.0
PHP Version:
8.2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
varnish
/
html
/
reference
/
View File Name :
vcl-var.html
<!DOCTYPE html> <html lang="en" data-content_root="../"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" /> <title>VCL-Variables — Varnish version 7.5.0 documentation</title> <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" /> <link rel="stylesheet" type="text/css" href="../_static/classic.css?v=e2714048" /> <script src="../_static/documentation_options.js?v=8214db13"></script> <script src="../_static/doctools.js?v=888ff710"></script> <script src="../_static/sphinx_highlight.js?v=dc90522c"></script> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="VCL-steps" href="vcl-step.html" /> <link rel="prev" title="VCL" href="vcl.html" /> </head><body> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="vcl-step.html" title="VCL-steps" accesskey="N">next</a> |</li> <li class="right" > <a href="vcl.html" title="VCL" accesskey="P">previous</a> |</li> <li class="nav-item nav-item-0"><a href="../index.html">Varnish version 7.5.0 documentation</a> »</li> <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">The Varnish Reference Manual</a> »</li> <li class="nav-item nav-item-this"><a href="">VCL-Variables</a></li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <section id="vcl-variables"> <span id="vcl-var-7"></span><h1>VCL-Variables<a class="headerlink" href="#vcl-variables" title="Link to this heading">¶</a></h1> <section id="the-complete-album"> <h2>The complete album<a class="headerlink" href="#the-complete-album" title="Link to this heading">¶</a></h2> <dl class="field-list simple"> <dt class="field-odd">Manual section<span class="colon">:</span></dt> <dd class="field-odd"><p>7</p> </dd> </dl> <section id="description"> <h3>DESCRIPTION<a class="headerlink" href="#description" title="Link to this heading">¶</a></h3> <p>This is a list of all variables in the VCL language.</p> <p>Variable names take the form <code class="docutils literal notranslate"><span class="pre">scope.variable[.index]</span></code>, for instance:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">req</span><span class="o">.</span><span class="n">url</span> <span class="n">beresp</span><span class="o">.</span><span class="n">http</span><span class="o">.</span><span class="n">date</span> <span class="n">client</span><span class="o">.</span><span class="n">ip</span> </pre></div> </div> <p>Which operations are possible on each variable is described below, often with the shorthand “backend” which covers the <code class="docutils literal notranslate"><span class="pre">vcl_backend_*</span> <span class="pre">{}</span></code> subroutines and “client” which covers the rest, except <code class="docutils literal notranslate"><span class="pre">vcl_init</span> <span class="pre">{}</span></code> and <code class="docutils literal notranslate"><span class="pre">vcl_fini</span> <span class="pre">{}</span></code>.</p> <section id="local-server-remote-and-client"> <span id="id1"></span><h4>local, server, remote and client<a class="headerlink" href="#local-server-remote-and-client" title="Link to this heading">¶</a></h4> <p>These variables describe the network connection between the client and varnishd.</p> <p>Without PROXY protocol:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">client</span> <span class="n">server</span> <span class="n">remote</span> <span class="n">local</span> <span class="n">v</span> <span class="n">v</span> <span class="n">CLIENT</span> <span class="o">------------</span> <span class="n">VARNISHD</span> </pre></div> </div> <p>With PROXY protocol:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">client</span> <span class="n">server</span> <span class="n">remote</span> <span class="n">local</span> <span class="n">v</span> <span class="n">v</span> <span class="n">v</span> <span class="n">v</span> <span class="n">CLIENT</span> <span class="o">------------</span> <span class="n">PROXY</span> <span class="o">------------</span> <span class="n">VARNISHD</span> </pre></div> </div> <p id="client-identity">client.identity</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: client, backend</p> <p>Writable from: client</p> <p>Identification of the client, used to load balance in the client director. Defaults to <code class="docutils literal notranslate"><span class="pre">client.ip</span></code></p> <p>This variable can be overwritten with more precise information, for instance extracted from a <code class="docutils literal notranslate"><span class="pre">Cookie:</span></code> header.</p> </div></blockquote> <p id="client-ip">client.ip</p> <blockquote> <div><p>Type: IP</p> <p>Readable from: client, backend</p> <p>The client’s IP address, either the same as <code class="docutils literal notranslate"><span class="pre">remote.ip</span></code> or what the PROXY protocol told us.</p> </div></blockquote> <p id="server-hostname">server.hostname</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: all</p> <p>The host name of the server, as returned by the <cite>gethostname(3)</cite> system function.</p> </div></blockquote> <p id="server-identity">server.identity</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: all</p> <p>The identity of the server, as set by the <code class="docutils literal notranslate"><span class="pre">-i</span></code> parameter.</p> <p>If an <code class="docutils literal notranslate"><span class="pre">-i</span></code> parameter is not passed to varnishd, the return value from <cite>gethostname(3)</cite> system function will be used.</p> </div></blockquote> <p id="server-ip">server.ip</p> <blockquote> <div><p>Type: IP</p> <p>Readable from: client, backend</p> <p>The IP address of the socket on which the client connection was received, either the same as <code class="docutils literal notranslate"><span class="pre">server.ip</span></code> or what the PROXY protocol told us.</p> </div></blockquote> <p id="remote-ip">remote.ip</p> <blockquote> <div><p>Type: IP</p> <p>Readable from: client, backend</p> <p>The IP address of the other end of the TCP connection. This can either be the clients IP, or the outgoing IP of a proxy server.</p> <p>If the connection is a UNIX domain socket, the value will be <code class="docutils literal notranslate"><span class="pre">0.0.0.0:0</span></code></p> </div></blockquote> <p id="local-endpoint">local.endpoint <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre">>=</span> <span class="pre">4.1</span></code></p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: client, backend</p> <p>The address of the ‘-a’ socket the session was accepted on.</p> <p>If the argument was <code class="docutils literal notranslate"><span class="pre">-a</span> <span class="pre">foo=:81</span></code> this would be “:81”</p> </div></blockquote> <p id="local-ip">local.ip</p> <blockquote> <div><p>Type: IP</p> <p>Readable from: client, backend</p> <p>The IP address (and port number) of the local end of the TCP connection, for instance <code class="docutils literal notranslate"><span class="pre">192.168.1.1:81</span></code></p> <p>If the connection is a UNIX domain socket, the value will be <code class="docutils literal notranslate"><span class="pre">0.0.0.0:0</span></code></p> </div></blockquote> <p id="local-socket">local.socket <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre">>=</span> <span class="pre">4.1</span></code></p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: client, backend</p> <p>The name of the ‘-a’ socket the session was accepted on.</p> <p>If the argument was <code class="docutils literal notranslate"><span class="pre">-a</span> <span class="pre">foo=:81</span></code> this would be “foo”.</p> <p>Note that all ‘-a’ gets a default name on the form <code class="docutils literal notranslate"><span class="pre">a%d</span></code> if no name is provided.</p> </div></blockquote> </section> <section id="req-and-req-top"> <h4>req and req_top<a class="headerlink" href="#req-and-req-top" title="Link to this heading">¶</a></h4> <p>These variables describe the present request, and when ESI:include requests are being processed, req_top points to the request received from the client.</p> <p id="req">req</p> <blockquote> <div><p>Type: HTTP</p> <p>Readable from: client</p> <p>The entire request HTTP data structure. Mostly useful for passing to VMODs.</p> </div></blockquote> <p id="req-backend-hint">req.backend_hint</p> <blockquote> <div><p>Type: BACKEND</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>Set bereq.backend to this if we attempt to fetch. When set to a director, reading this variable returns an actual backend if the director has resolved immediately, or the director otherwise. When used in string context, returns the name of the director or backend, respectively.</p> </div></blockquote> <p id="req-can-gzip">req.can_gzip</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: client</p> <p>True if the client provided <code class="docutils literal notranslate"><span class="pre">gzip</span></code> or <code class="docutils literal notranslate"><span class="pre">x-gzip</span></code> in the <code class="docutils literal notranslate"><span class="pre">Accept-Encoding</span></code> header.</p> </div></blockquote> <p>req.esi <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre"><=</span> <span class="pre">4.0</span></code></p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>Set to <code class="docutils literal notranslate"><span class="pre">false</span></code> to disable ESI processing regardless of any value in beresp.do_esi. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. This variable is replaced by <code class="docutils literal notranslate"><span class="pre">resp.do_esi</span></code> in VCL 4.1.</p> </div></blockquote> <p id="req-esi-level">req.esi_level</p> <blockquote> <div><p>Type: INT</p> <p>Readable from: client</p> <p>A count of how many levels of ESI requests we’re currently at.</p> </div></blockquote> <p id="req-grace">req.grace</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>Upper limit on the object grace.</p> <p>During lookup the minimum of req.grace and the object’s stored grace value will be used as the object’s grace.</p> </div></blockquote> <p id="req-hash">req.hash</p> <blockquote> <div><p>Type: BLOB</p> <p>Readable from: vcl_hit, vcl_miss, vcl_pass, vcl_purge, vcl_deliver</p> <p>The hash key of this request. Mostly useful for passing to VMODs, but can also be useful for debugging hit/miss status.</p> </div></blockquote> <p id="req-hash-always-miss">req.hash_always_miss</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>Default: <code class="docutils literal notranslate"><span class="pre">false</span></code>.</p> <p>Force a cache miss for this request, even if perfectly good matching objects are in the cache.</p> <p>This is useful to force-update the cache without invalidating existing entries in case the fetch fails.</p> </div></blockquote> <p id="req-hash-ignore-busy">req.hash_ignore_busy</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>Default: <code class="docutils literal notranslate"><span class="pre">false</span></code>.</p> <p>Ignore any busy object during cache lookup.</p> <p>You only want to do this when you have two server looking up content sideways from each other to avoid deadlocks.</p> </div></blockquote> <p id="req-hash-ignore-vary">req.hash_ignore_vary</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>Default: <code class="docutils literal notranslate"><span class="pre">false</span></code>.</p> <p>Ignore objects vary headers during cache lookup.</p> <p>This returns the very first match regardless of the object compatibility with the client request. This is useful when variants are irrelevant to certain clients, and differences in the way the resouce is presented don’t change how the client will interpret it.</p> <p>Use with caution.</p> </div></blockquote> <p id="req-http">req.http.*</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>Unsetable from: client</p> <p>The headers of request, things like <code class="docutils literal notranslate"><span class="pre">req.http.date</span></code>.</p> <p>The RFCs allow multiple headers with the same name, and both <code class="docutils literal notranslate"><span class="pre">set</span></code> and <code class="docutils literal notranslate"><span class="pre">unset</span></code> will remove <em>all</em> headers with the name given.</p> <p>The header name <code class="docutils literal notranslate"><span class="pre">*</span></code> is a VCL symbol and as such cannot, for example, start with a numeral. To work with valid header that can’t be represented as VCL symbols it is possible to quote the name, like <code class="docutils literal notranslate"><span class="pre">req.http."grammatically.valid"</span></code>. None of the HTTP headers present in IANA registries need to be quoted, so the quoted syntax is discouraged but available for interoperability.</p> <p>Some headers that cannot be tampered with for proper HTTP fetch or delivery are read-only.</p> </div></blockquote> <p>req.http.content-length</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: client</p> <p>The content-length header field is protected, see <a class="reference internal" href="#protected-headers">protected_headers</a>.</p> </div></blockquote> <p>req.http.transfer-encoding</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: client</p> <p>The transfer-encoding header field is protected, see <a class="reference internal" href="#protected-headers">protected_headers</a>.</p> </div></blockquote> <p id="req-is-hitmiss">req.is_hitmiss</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: client</p> <p>If this request resulted in a hitmiss</p> </div></blockquote> <p id="req-is-hitpass">req.is_hitpass</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: client</p> <p>If this request resulted in a hitpass</p> </div></blockquote> <p id="req-method">req.method</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>The request method (e.g. “GET”, “HEAD”, …)</p> </div></blockquote> <p>req.proto <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre"><=</span> <span class="pre">4.0</span></code></p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>The HTTP protocol version used by the client, usually “HTTP/1.1” or “HTTP/2.0”.</p> </div></blockquote> <p id="req-proto">req.proto <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre">>=</span> <span class="pre">4.1</span></code></p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: client</p> <p>The HTTP protocol version used by the client, usually “HTTP/1.1” or “HTTP/2.0”.</p> </div></blockquote> <p id="req-restarts">req.restarts</p> <blockquote> <div><p>Type: INT</p> <p>Readable from: client</p> <p>A count of how many times this request has been restarted.</p> </div></blockquote> <p id="req-storage">req.storage</p> <blockquote> <div><p>Type: STEVEDORE</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>The storage backend to use to save this request body.</p> </div></blockquote> <p id="req-time">req.time</p> <blockquote> <div><p>Type: TIME</p> <p>Readable from: client</p> <p>The time when the request was fully received, remains constant across restarts.</p> </div></blockquote> <p id="req-trace">req.trace</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>Controls if <code class="docutils literal notranslate"><span class="pre">VCL_trace</span></code> VSL records are emitted for the current request, see <a class="reference internal" href="vsl.html#vsl-7"><span class="std std-ref">VSL</span></a>.</p> <p>Defaults to the setting of the <code class="docutils literal notranslate"><span class="pre">feature</span> <span class="pre">trace</span></code> parameter, see <a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a>. Does not get reset by a rollback.</p> </div></blockquote> <p id="req-transport">req.transport</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: client</p> <p>The transport protocol which brought this request.</p> </div></blockquote> <p id="req-ttl">req.ttl</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>Upper limit on the object age for cache lookups to return hit.</p> </div></blockquote> <p id="req-url">req.url</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>The requested URL, for instance “/robots.txt”.</p> </div></blockquote> <p id="req-xid">req.xid</p> <blockquote> <div><p>Type: INT</p> <p>Readable from: client</p> <p>Unique ID of this request.</p> </div></blockquote> <p id="req-top-http">req_top.http.*</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: client</p> <p>HTTP headers of the top-level request in a tree of ESI requests. Identical to req.http. in non-ESI requests.</p> <p>See <a class="reference internal" href="#req-http">req.http</a> for general notes.</p> </div></blockquote> <p id="req-top-method">req_top.method</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: client</p> <p>The request method of the top-level request in a tree of ESI requests. (e.g. “GET”, “HEAD”). Identical to req.method in non-ESI requests.</p> </div></blockquote> <p id="req-top-proto">req_top.proto</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: client</p> <p>HTTP protocol version of the top-level request in a tree of ESI requests. Identical to req.proto in non-ESI requests.</p> </div></blockquote> <p id="req-top-time">req_top.time</p> <blockquote> <div><p>Type: TIME</p> <p>Readable from: client</p> <p>The time when the top-level request was fully received, remains constant across restarts.</p> </div></blockquote> <p id="req-top-url">req_top.url</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: client</p> <p>The requested URL of the top-level request in a tree of ESI requests. Identical to req.url in non-ESI requests.</p> </div></blockquote> </section> <section id="bereq"> <h4>bereq<a class="headerlink" href="#bereq" title="Link to this heading">¶</a></h4> <p>This is the request we send to the backend, it is built from the clients <code class="docutils literal notranslate"><span class="pre">req.*</span></code> fields by filtering out “per-hop” fields which should not be passed along (<code class="docutils literal notranslate"><span class="pre">Connection:</span></code>, <code class="docutils literal notranslate"><span class="pre">Range:</span></code> and similar).</p> <p>Slightly more fields are allowed through for <code class="docutils literal notranslate"><span class="pre">pass`</span> <span class="pre">fetches</span> <span class="pre">than</span> <span class="pre">for</span> <span class="pre">`miss`</span> <span class="pre">fetches,</span> <span class="pre">for</span> <span class="pre">instance</span> <span class="pre">``Range</span></code>.</p> <p>bereq</p> <blockquote> <div><p>Type: HTTP</p> <p>Readable from: backend</p> <p>The entire backend request HTTP data structure. Mostly useful as argument to VMODs.</p> </div></blockquote> <p id="bereq-backend">bereq.backend</p> <blockquote> <div><p>Type: BACKEND</p> <p>Readable from: vcl_pipe, backend</p> <p>Writable from: vcl_pipe, backend</p> <p>This is the backend or director we attempt to fetch from. When set to a director, reading this variable returns an actual backend if the director has resolved immediately, or the director otherwise. When used in string context, returns the name of the director or backend, respectively.</p> </div></blockquote> <p id="bereq-between-bytes-timeout">bereq.between_bytes_timeout</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: backend</p> <p>Writable from: backend</p> <p>Unsetable from: vcl_pipe, backend</p> <p>Default: <code class="docutils literal notranslate"><span class="pre">.between_bytes_timeout</span></code> attribute from the <a class="reference internal" href="vcl-backend.html#backend-definition"><span class="std std-ref">Backend definition</span></a>, which defaults to the <code class="docutils literal notranslate"><span class="pre">between_bytes_timeout</span></code> parameter, see <a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a>.</p> <p>The time in seconds to wait between each received byte from the backend. Not available in pipe mode.</p> </div></blockquote> <p id="bereq-body">bereq.body</p> <blockquote> <div><p>Type: BODY</p> <p>Unsetable from: vcl_backend_fetch</p> <p>The request body.</p> <p>Unset will also remove <a class="reference internal" href="#bereq-http-content-length">bereq.http.content-length</a>.</p> </div></blockquote> <p id="bereq-connect-timeout">bereq.connect_timeout</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: vcl_pipe, backend</p> <p>Writable from: vcl_pipe, backend</p> <p>Unsetable from: vcl_pipe, backend</p> <p>Default: <code class="docutils literal notranslate"><span class="pre">.connect_timeout</span></code> attribute from the <a class="reference internal" href="vcl-backend.html#backend-definition"><span class="std std-ref">Backend definition</span></a>, which defaults to the <code class="docutils literal notranslate"><span class="pre">connect_timeout</span></code> parameter, see <a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a>.</p> <p>The time in seconds to wait for a backend connection to be established.</p> </div></blockquote> <p id="bereq-first-byte-timeout">bereq.first_byte_timeout</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: backend</p> <p>Writable from: backend</p> <p>Unsetable from: vcl_pipe, backend</p> <p>Default: <code class="docutils literal notranslate"><span class="pre">.first_byte_timeout</span></code> attribute from the <a class="reference internal" href="vcl-backend.html#backend-definition"><span class="std std-ref">Backend definition</span></a>, which defaults to the <code class="docutils literal notranslate"><span class="pre">first_byte_timeout</span></code> parameter, see <a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a>.</p> <p>The time in seconds to wait getting the first byte back from the backend. Not available in pipe mode.</p> </div></blockquote> <p id="bereq-hash">bereq.hash</p> <blockquote> <div><p>Type: BLOB</p> <p>Readable from: vcl_pipe, backend</p> <p>The hash key of this request, a copy of <code class="docutils literal notranslate"><span class="pre">req.hash</span></code>.</p> </div></blockquote> <p id="bereq-http">bereq.http.*</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: vcl_pipe, backend</p> <p>Writable from: vcl_pipe, backend</p> <p>Unsetable from: vcl_pipe, backend</p> <p>The headers to be sent to the backend.</p> <p>See <a class="reference internal" href="#req-http">req.http</a> for general notes.</p> </div></blockquote> <p id="bereq-http-content-length">bereq.http.content-length</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: backend</p> <p>The content-length header field is protected, see <a class="reference internal" href="#protected-headers">protected_headers</a>.</p> </div></blockquote> <p>bereq.http.transfer-encoding</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: backend</p> <p>The transfer-encoding header field is protected, see <a class="reference internal" href="#protected-headers">protected_headers</a>.</p> </div></blockquote> <p id="bereq-is-bgfetch">bereq.is_bgfetch</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: backend</p> <p>True for fetches where the client got a hit on an object in grace, and this fetch was kicked of in the background to get a fresh copy.</p> </div></blockquote> <p id="bereq-is-hitmiss">bereq.is_hitmiss</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: backend</p> <p>If this backend request was caused by a hitmiss.</p> </div></blockquote> <p id="bereq-is-hitpass">bereq.is_hitpass</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: backend</p> <p>If this backend request was caused by a hitpass.</p> </div></blockquote> <p id="bereq-method">bereq.method</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_pipe, backend</p> <p>Writable from: vcl_pipe, backend</p> <p>The request type (e.g. “GET”, “HEAD”).</p> <p>Regular (non-pipe, non-pass) fetches are always “GET”</p> </div></blockquote> <p>bereq.proto <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre"><=</span> <span class="pre">4.0</span></code></p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_pipe, backend</p> <p>Writable from: vcl_pipe, backend</p> <p>The HTTP protocol version, “HTTP/1.1” unless a pass or pipe request has “HTTP/1.0” in <code class="docutils literal notranslate"><span class="pre">req.proto</span></code></p> </div></blockquote> <p id="bereq-proto">bereq.proto <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre">>=</span> <span class="pre">4.1</span></code></p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_pipe, backend</p> <p>The HTTP protocol version, “HTTP/1.1” unless a pass or pipe request has “HTTP/1.0” in <code class="docutils literal notranslate"><span class="pre">req.proto</span></code></p> </div></blockquote> <p id="bereq-retries">bereq.retries</p> <blockquote> <div><p>Type: INT</p> <p>Readable from: backend</p> <p>A count of how many times this request has been retried.</p> </div></blockquote> <p id="bereq-task-deadline">bereq.task_deadline</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: vcl_pipe</p> <p>Writable from: vcl_pipe</p> <p>Unsetable from: vcl_pipe</p> <p>Deadline for pipe sessions, defaults <code class="docutils literal notranslate"><span class="pre">0s</span></code>, which falls back to the <code class="docutils literal notranslate"><span class="pre">pipe_task_deadline</span></code> parameter, see <a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a></p> </div></blockquote> <p id="bereq-time">bereq.time</p> <blockquote> <div><p>Type: TIME</p> <p>Readable from: vcl_pipe, backend</p> <p>The time when we started preparing the first backend request, remains constant across retries.</p> </div></blockquote> <p id="bereq-trace">bereq.trace</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: backend</p> <p>Writable from: backend</p> <p>Controls if <code class="docutils literal notranslate"><span class="pre">VCL_trace</span></code> VSL records are emitted for the current request, see <a class="reference internal" href="vsl.html#vsl-7"><span class="std std-ref">VSL</span></a>.</p> <p>Inherits the value of <code class="docutils literal notranslate"><span class="pre">req.trace</span></code> when the backend request is created. Does not get reset by a rollback.</p> </div></blockquote> <p id="bereq-uncacheable">bereq.uncacheable</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: backend</p> <p>Indicates whether this request is uncacheable due to a <cite>pass</cite> in the client side or a hit on an hit-for-pass object.</p> </div></blockquote> <p id="bereq-url">bereq.url</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_pipe, backend</p> <p>Writable from: vcl_pipe, backend</p> <p>The requested URL, copied from <code class="docutils literal notranslate"><span class="pre">req.url</span></code></p> </div></blockquote> <p id="bereq-xid">bereq.xid</p> <blockquote> <div><p>Type: INT</p> <p>Readable from: vcl_pipe, backend</p> <p>Unique ID of this request.</p> </div></blockquote> </section> <section id="beresp"> <h4>beresp<a class="headerlink" href="#beresp" title="Link to this heading">¶</a></h4> <p>The response received from the backend, one cache misses, the store object is built from <code class="docutils literal notranslate"><span class="pre">beresp</span></code>.</p> <p>beresp</p> <blockquote> <div><p>Type: HTTP</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>The entire backend response HTTP data structure, useful as argument to VMOD functions.</p> </div></blockquote> <p id="beresp-age">beresp.age</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Default: Age header, or zero.</p> <p>The age of the object.</p> </div></blockquote> <p id="beresp-backend">beresp.backend</p> <blockquote> <div><p>Type: BACKEND</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>This is the backend we fetched from. If bereq.backend was set to a director, this will be the backend selected by the director. When used in string context, returns its name.</p> </div></blockquote> <p>beresp.backend.ip <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre"><=</span> <span class="pre">4.0</span></code></p> <blockquote> <div><p>Type: IP</p> <p>Readable from: vcl_backend_response</p> <p>IP of the backend this response was fetched from.</p> </div></blockquote> <p id="beresp-backend-name">beresp.backend.name</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Name of the backend this response was fetched from. Same as beresp.backend.</p> </div></blockquote> <p id="beresp-body">beresp.body</p> <blockquote> <div><p>Type: BODY</p> <p>Writable from: vcl_backend_error</p> <p>For producing a synthetic body.</p> </div></blockquote> <p id="beresp-do-esi">beresp.do_esi</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>Default: <code class="docutils literal notranslate"><span class="pre">false</span></code>.</p> <p>Set it to true to parse the object for ESI directives. This is necessary for later ESI processing on the client side. If beresp.do_esi is false when an object enters the cache, client side ESI processing will not be possible (obj.can_esi will be false).</p> <p>It is a VCL error to use beresp.do_esi after setting beresp.filters.</p> </div></blockquote> <p id="beresp-do-gunzip">beresp.do_gunzip</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>Default: <code class="docutils literal notranslate"><span class="pre">false</span></code>.</p> <p>Set to <code class="docutils literal notranslate"><span class="pre">true</span></code> to gunzip the object while storing it in the cache.</p> <p>If <code class="docutils literal notranslate"><span class="pre">http_gzip_support</span></code> is disabled, setting this variable has no effect.</p> <p>It is a VCL error to use beresp.do_gunzip after setting beresp.filters.</p> </div></blockquote> <p id="beresp-do-gzip">beresp.do_gzip</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>Default: <code class="docutils literal notranslate"><span class="pre">false</span></code>.</p> <p>Set to <code class="docutils literal notranslate"><span class="pre">true</span></code> to gzip the object while storing it.</p> <p>If <code class="docutils literal notranslate"><span class="pre">http_gzip_support</span></code> is disabled, setting this variable has no effect.</p> <p>It is a VCL error to use beresp.do_gzip after setting beresp.filters.</p> </div></blockquote> <p id="beresp-do-stream">beresp.do_stream</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>Default: <code class="docutils literal notranslate"><span class="pre">true</span></code>.</p> <p>Deliver the object to the client while fetching the whole object into varnish.</p> <p>For uncacheable objects, storage for parts of the body which have been sent to the client may get freed early, depending on the storage engine used.</p> <p>This variable has no effect if beresp.do_esi is true or when the response body is empty.</p> </div></blockquote> <p id="beresp-filters">beresp.filters</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_backend_response</p> <p>Writable from: vcl_backend_response</p> <p>List of Varnish Fetch Processor (VFP) filters the beresp.body will be pulled through. The order left to right signifies processing from backend to cache, iow the leftmost filter is run first on the body as received from the backend after decoding of any transfer encodings.</p> <p>VFP Filters change the body before going into the cache and/or being handed to the client side, where it may get processed again by resp.filters.</p> <p>The following VFP filters exist in varnish-cache:</p> <ul> <li><p><code class="docutils literal notranslate"><span class="pre">gzip</span></code>: compress a body using gzip</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">testgunzip</span></code>: Test if a body is valid gzip and refuse it otherwise</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">gunzip</span></code>: Uncompress gzip content</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">esi</span></code>: ESI-process plain text content</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">esi_gzip</span></code>: Save gzipped snippets for efficient ESI-processing</p> <p>This filter enables stitching together ESI from individually gzipped fragments, saving processing power for re-compression on the client side at the expense of some compression efficiency.</p> </li> </ul> <p>Additional VFP filters are available from VMODs.</p> <p>By default, beresp.filters is constructed as follows:</p> <ul class="simple"> <li><p><code class="docutils literal notranslate"><span class="pre">gunzip</span></code> gets added for gzipped content if <code class="docutils literal notranslate"><span class="pre">beresp.do_gunzip</span></code> or <code class="docutils literal notranslate"><span class="pre">beresp.do_esi</span></code> are true.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">esi_gzip</span></code> gets added if <code class="docutils literal notranslate"><span class="pre">beresp.do_esi</span></code> is true together with <code class="docutils literal notranslate"><span class="pre">beresp.do_gzip</span></code> or content is already compressed.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">esi</span></code> gets added if <code class="docutils literal notranslate"><span class="pre">beresp.do_esi</span></code> is true</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">gzip</span></code> gets added for uncompressed content if <code class="docutils literal notranslate"><span class="pre">beresp.do_gzip</span></code> is true</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">testgunzip</span></code> gets added for compressed content if <code class="docutils literal notranslate"><span class="pre">beresp.do_gunzip</span></code> is false.</p></li> </ul> <p>After beresp.filters is set, using any of the beforementioned <code class="docutils literal notranslate"><span class="pre">beresp.do_*</span></code> switches is a VCL error.</p> </div></blockquote> <p id="beresp-grace">beresp.grace</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>Default: Cache-Control <code class="docutils literal notranslate"><span class="pre">stale-while-revalidate</span></code> directive, or <code class="docutils literal notranslate"><span class="pre">default_grace</span></code> parameter.</p> <p>Set to a period to enable grace.</p> </div></blockquote> <p id="beresp-http">beresp.http.*</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>Unsetable from: vcl_backend_response, vcl_backend_error</p> <p>The HTTP headers returned from the server.</p> <p>See <a class="reference internal" href="#req-http">req.http</a> for general notes.</p> </div></blockquote> <p>beresp.http.content-length</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>The content-length header field is protected, see <a class="reference internal" href="#protected-headers">protected_headers</a>.</p> </div></blockquote> <p>beresp.http.transfer-encoding</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>The transfer-encoding header field is protected, see <a class="reference internal" href="#protected-headers">protected_headers</a>.</p> </div></blockquote> <p id="beresp-keep">beresp.keep</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>Default: <code class="docutils literal notranslate"><span class="pre">default_keep</span></code> parameter.</p> <p>Set to a period to enable conditional backend requests.</p> <p>The keep time is cache lifetime in addition to the ttl.</p> <p>Objects with ttl expired but with keep time left may be used to issue conditional (If-Modified-Since / If-None-Match) requests to the backend to refresh them.</p> </div></blockquote> <p>beresp.proto <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre"><=</span> <span class="pre">4.0</span></code></p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>The HTTP protocol version the backend replied with.</p> </div></blockquote> <p id="beresp-proto">beresp.proto <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre">>=</span> <span class="pre">4.1</span></code></p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>The HTTP protocol version the backend replied with.</p> </div></blockquote> <p id="beresp-reason">beresp.reason</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>The HTTP status message returned by the server.</p> </div></blockquote> <p id="beresp-status">beresp.status</p> <blockquote> <div><p>Type: INT</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>The HTTP status code returned by the server.</p> <p>More information in the <a class="reference internal" href="#http-response-status">HTTP response status</a> section.</p> </div></blockquote> <p id="beresp-storage">beresp.storage</p> <blockquote> <div><p>Type: STEVEDORE</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>The storage backend to use to save this object.</p> </div></blockquote> <p>beresp.storage_hint <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre"><=</span> <span class="pre">4.0</span></code></p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>Deprecated since varnish 5.1 and discontinued since VCL 4.1 (varnish 6.0). Use beresp.storage instead.</p> <p>Hint to Varnish that you want to save this object to a particular storage backend.</p> </div></blockquote> <p id="beresp-time">beresp.time</p> <blockquote> <div><p>Type: TIME</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>When the backend headers were fully received just before <code class="docutils literal notranslate"><span class="pre">vcl_backend_response</span> <span class="pre">{}</span></code> was entered, or when <code class="docutils literal notranslate"><span class="pre">vcl_backend_error</span> <span class="pre">{}</span></code> was entered.</p> </div></blockquote> <p id="beresp-transit-buffer">beresp.transit_buffer</p> <blockquote> <div><p>Type: BYTES</p> <p>Readable from: vcl_backend_response</p> <p>Writable from: vcl_backend_response</p> <p>Default: <code class="docutils literal notranslate"><span class="pre">transit_buffer</span></code> parameter, see <a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a>.</p> <p>The maximum number of bytes the client can be ahead of the backend during a streaming pass if <code class="docutils literal notranslate"><span class="pre">beresp</span></code> is uncacheable. See also <code class="docutils literal notranslate"><span class="pre">transit_buffer</span></code> parameter documentation in <a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a>.</p> </div></blockquote> <p id="beresp-ttl">beresp.ttl</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>Default: Cache-Control <code class="docutils literal notranslate"><span class="pre">s-maxage</span></code> or <code class="docutils literal notranslate"><span class="pre">max-age</span></code> directives, or a value computed from the Expires header’s deadline, or the <code class="docutils literal notranslate"><span class="pre">default_ttl</span></code> parameter.</p> <p>The object’s remaining time to live, in seconds.</p> </div></blockquote> <p id="beresp-uncacheable">beresp.uncacheable</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>Writable from: vcl_backend_response, vcl_backend_error</p> <p>Inherited from bereq.uncacheable, see there.</p> <p>Setting this variable makes the object uncacheable.</p> <p>This may may produce a hit-for-miss object in the cache.</p> <p>Clearing the variable has no effect and will log the warning “Ignoring attempt to reset beresp.uncacheable”.</p> </div></blockquote> <p id="beresp-was-304">beresp.was_304</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: vcl_backend_response, vcl_backend_error</p> <p>When <code class="docutils literal notranslate"><span class="pre">true</span></code> this indicates that we got a 304 response to our conditional fetch from the backend and turned that into <code class="docutils literal notranslate"><span class="pre">beresp.status</span> <span class="pre">=</span> <span class="pre">200</span></code></p> </div></blockquote> </section> <section id="obj"> <h4>obj<a class="headerlink" href="#obj" title="Link to this heading">¶</a></h4> <p>This is the object we found in cache. It cannot be modified.</p> <p id="obj-age">obj.age</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: vcl_hit, vcl_deliver</p> <p>The age of the object.</p> </div></blockquote> <p id="obj-can-esi">obj.can_esi</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: vcl_hit, vcl_deliver</p> <p>If the object can be ESI processed, that is if setting <code class="docutils literal notranslate"><span class="pre">resp.do_esi</span></code> or adding <code class="docutils literal notranslate"><span class="pre">esi</span></code> to <code class="docutils literal notranslate"><span class="pre">resp.filters</span></code> in <code class="docutils literal notranslate"><span class="pre">vcl_deliver</span> <span class="pre">{}</span></code> would cause the response body to be ESI processed.</p> </div></blockquote> <p id="obj-grace">obj.grace</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: vcl_hit, vcl_deliver</p> <p>The object’s grace period in seconds.</p> </div></blockquote> <p id="obj-hits">obj.hits</p> <blockquote> <div><p>Type: INT</p> <p>Readable from: vcl_hit, vcl_deliver</p> <p>The count of cache-hits on this object.</p> <p>In <cite>vcl_deliver</cite> a value of 0 indicates a cache miss.</p> </div></blockquote> <p id="obj-http">obj.http.*</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: vcl_hit</p> <p>The HTTP headers stored in the object.</p> <p>See <a class="reference internal" href="#req-http">req.http</a> for general notes.</p> </div></blockquote> <p id="obj-keep">obj.keep</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: vcl_hit, vcl_deliver</p> <p>The object’s keep period in seconds.</p> </div></blockquote> <p id="obj-proto">obj.proto</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_hit</p> <p>The HTTP protocol version stored in the object.</p> </div></blockquote> <p id="obj-reason">obj.reason</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_hit</p> <p>The HTTP reason phrase stored in the object.</p> </div></blockquote> <p id="obj-status">obj.status</p> <blockquote> <div><p>Type: INT</p> <p>Readable from: vcl_hit</p> <p>The HTTP status code stored in the object.</p> <p>More information in the <a class="reference internal" href="#http-response-status">HTTP response status</a> section.</p> </div></blockquote> <p id="obj-storage">obj.storage</p> <blockquote> <div><p>Type: STEVEDORE</p> <p>Readable from: vcl_hit, vcl_deliver</p> <p>The storage backend where this object is stored.</p> </div></blockquote> <p id="obj-time">obj.time</p> <blockquote> <div><p>Type: TIME</p> <p>Readable from: vcl_hit, vcl_deliver</p> <p>The time the object was created from the perspective of the server which generated it. This will roughly be equivalent to <code class="docutils literal notranslate"><span class="pre">now</span></code> - <code class="docutils literal notranslate"><span class="pre">obj.age</span></code>.</p> </div></blockquote> <p id="obj-ttl">obj.ttl</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: vcl_hit, vcl_deliver</p> <p>The object’s remaining time to live, in seconds.</p> </div></blockquote> <p id="obj-uncacheable">obj.uncacheable</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: vcl_deliver</p> <p>Whether the object is uncacheable (pass, hit-for-pass or hit-for-miss).</p> </div></blockquote> </section> <section id="resp"> <h4>resp<a class="headerlink" href="#resp" title="Link to this heading">¶</a></h4> <p>This is the response we send to the client, it is built from either <code class="docutils literal notranslate"><span class="pre">beresp</span></code> (pass/miss), <code class="docutils literal notranslate"><span class="pre">obj</span></code> (hits) or created from whole cloth (synth).</p> <p>With the exception of <code class="docutils literal notranslate"><span class="pre">resp.body</span></code> all <code class="docutils literal notranslate"><span class="pre">resp.*</span></code> variables available in both <code class="docutils literal notranslate"><span class="pre">vcl_deliver{}</span></code> and <code class="docutils literal notranslate"><span class="pre">vcl_synth{}</span></code> as a matter of symmetry.</p> <p>resp</p> <blockquote> <div><p>Type: HTTP</p> <p>Readable from: vcl_deliver, vcl_synth</p> <p>The entire response HTTP data structure, useful as argument to VMODs.</p> </div></blockquote> <p id="resp-body">resp.body</p> <blockquote> <div><p>Type: BODY</p> <p>Writable from: vcl_synth</p> <p>To produce a synthetic response body, for instance for errors.</p> </div></blockquote> <p id="resp-do-esi">resp.do_esi <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre">>=</span> <span class="pre">4.1</span></code></p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: vcl_deliver, vcl_synth</p> <p>Writable from: vcl_deliver, vcl_synth</p> <p>Default: obj.can_esi</p> <p>This can be used to selectively disable ESI processing, even though ESI parsing happened during fetch (see beresp.do_esi). This is useful when Varnish caches peer with each other.</p> <p>It is a VCL error to use resp.do_esi after setting resp.filters.</p> </div></blockquote> <p id="resp-filters">resp.filters</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_deliver, vcl_synth</p> <p>Writable from: vcl_deliver, vcl_synth</p> <p>List of VDP filters the resp.body will be pushed through.</p> <p>Before resp.filters is set, the value read will be the default filter list as determined by varnish based on resp.do_esi and request headers.</p> <p>After resp.filters is set, changing any of the conditions which otherwise determine the filter selection will have no effiect. Using resp.do_esi is an error once resp.filters is set.</p> </div></blockquote> <p id="resp-http">resp.http.*</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: vcl_deliver, vcl_synth</p> <p>Writable from: vcl_deliver, vcl_synth</p> <p>Unsetable from: vcl_deliver, vcl_synth</p> <p>The HTTP headers that will be returned.</p> <p>See <a class="reference internal" href="#req-http">req.http</a> for general notes.</p> </div></blockquote> <p>resp.http.content-length</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: vcl_deliver, vcl_synth</p> <p>The content-length header field is protected, see <a class="reference internal" href="#protected-headers">protected_headers</a>.</p> </div></blockquote> <p>resp.http.transfer-encoding</p> <blockquote> <div><p>Type: HEADER</p> <p>Readable from: vcl_deliver, vcl_synth</p> <p>The transfer-encoding header field is protected, see <a class="reference internal" href="#protected-headers">protected_headers</a>.</p> </div></blockquote> <p id="resp-is-streaming">resp.is_streaming</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: vcl_deliver, vcl_synth</p> <p>Returns true when the response will be streamed while being fetched from the backend.</p> </div></blockquote> <p>resp.proto <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre"><=</span> <span class="pre">4.0</span></code></p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_deliver, vcl_synth</p> <p>Writable from: vcl_deliver, vcl_synth</p> <p>The HTTP protocol version to use for the response.</p> </div></blockquote> <p id="resp-proto">resp.proto <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre">>=</span> <span class="pre">4.1</span></code></p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_deliver, vcl_synth</p> <p>The HTTP protocol version to use for the response.</p> </div></blockquote> <p id="resp-reason">resp.reason</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_deliver, vcl_synth</p> <p>Writable from: vcl_deliver, vcl_synth</p> <p>The HTTP status message that will be returned.</p> </div></blockquote> <p id="resp-status">resp.status</p> <blockquote> <div><p>Type: INT</p> <p>Readable from: vcl_deliver, vcl_synth</p> <p>Writable from: vcl_deliver, vcl_synth</p> <p>The HTTP status code that will be returned.</p> <p>More information in the <a class="reference internal" href="#http-response-status">HTTP response status</a> section.</p> <p>resp.status 200 will get changed into 304 by core code after a return(deliver) from vcl_deliver for conditional requests to cached content if validation succeeds.</p> <p>For the validation, first <code class="docutils literal notranslate"><span class="pre">req.http.If-None-Match</span></code> is compared against <code class="docutils literal notranslate"><span class="pre">resp.http.Etag</span></code>. If they compare equal according to the rules for weak validation (see RFC7232), a 304 is sent.</p> <p>Secondly, <code class="docutils literal notranslate"><span class="pre">req.http.If-Modified-Since</span></code> is compared against <code class="docutils literal notranslate"><span class="pre">resp.http.Last-Modified</span></code> or, if it is unset or weak, against the point in time when the object was last modified based on the <code class="docutils literal notranslate"><span class="pre">Date</span></code> and <code class="docutils literal notranslate"><span class="pre">Age</span></code> headers received with the backend response which created the object. If the object has not been modified based on that comparison, a 304 is sent.</p> </div></blockquote> <p id="resp-time">resp.time</p> <blockquote> <div><p>Type: TIME</p> <p>Readable from: vcl_deliver, vcl_synth</p> <p>The time when we started preparing the response, just before entering <code class="docutils literal notranslate"><span class="pre">vcl_synth</span> <span class="pre">{}</span></code> or <code class="docutils literal notranslate"><span class="pre">vcl_deliver</span> <span class="pre">{}</span></code>.</p> </div></blockquote> </section> <section id="special-variables"> <h4>Special variables<a class="headerlink" href="#special-variables" title="Link to this heading">¶</a></h4> <p id="now">now</p> <blockquote> <div><p>Type: TIME</p> <p>Readable from: all</p> <p>The current time, in seconds since the UNIX epoch.</p> <p>When converted to STRING in expressions it returns a formatted timestamp like <code class="docutils literal notranslate"><span class="pre">Tue,</span> <span class="pre">20</span> <span class="pre">Feb</span> <span class="pre">2018</span> <span class="pre">09:30:31</span> <span class="pre">GMT</span></code></p> <p><code class="docutils literal notranslate"><span class="pre">now</span></code> remains stable for the duration of any built-in VCL subroutine to make time-based calculations predictable and avoid edge cases.</p> <p>In other words, even if considerable amounts of time are spent in VCL, <code class="docutils literal notranslate"><span class="pre">now</span></code> will always represent the point in time when the respective built-in VCL subroutine was entered. <code class="docutils literal notranslate"><span class="pre">now</span></code> is thus not suitable for any kind of time measurements. See <a class="reference internal" href="vmod_std.html#std-timestamp"><span class="std std-ref">VOID timestamp(STRING s)</span></a>, <a class="reference internal" href="vmod_std.html#std-now"><span class="std std-ref">TIME now()</span></a> and <a class="reference internal" href="vmod_std.html#std-timed-call"><span class="std std-ref">DURATION timed_call(SUB)</span></a> in <a class="reference internal" href="vmod_std.html#vmod-std-3"><span class="std std-ref">VMOD std - Varnish Standard Module</span></a>.</p> </div></blockquote> </section> <section id="sess"> <h4>sess<a class="headerlink" href="#sess" title="Link to this heading">¶</a></h4> <p>A session corresponds to the “conversation” that Varnish has with a single client connection, over which one or more request/response transactions may take place. It may comprise the traffic over an HTTP/1 keep-alive connection, or the multiplexed traffic over an HTTP/2 connection.</p> <p id="sess-idle-send-timeout">sess.idle_send_timeout</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>Unsetable from: client</p> <p>Send timeout for individual pieces of data on client connections, defaults to the <code class="docutils literal notranslate"><span class="pre">idle_send_timeout</span></code> parameter, see <a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a></p> </div></blockquote> <p id="sess-send-timeout">sess.send_timeout</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>Unsetable from: client</p> <p>Total timeout for ordinary HTTP1 responses, defaults to the <code class="docutils literal notranslate"><span class="pre">send_timeout</span></code> parameter, see <a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a></p> </div></blockquote> <p id="sess-timeout-idle">sess.timeout_idle</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>Unsetable from: client</p> <p>Idle timeout for this session, defaults to the <code class="docutils literal notranslate"><span class="pre">timeout_idle</span></code> parameter, see <a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a></p> </div></blockquote> <p id="sess-timeout-linger">sess.timeout_linger</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: client</p> <p>Writable from: client</p> <p>Unsetable from: client</p> <p>Linger timeout for this session, defaults to the <code class="docutils literal notranslate"><span class="pre">timeout_linger</span></code> parameter, see <a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a></p> </div></blockquote> <p id="sess-xid">sess.xid <code class="docutils literal notranslate"><span class="pre">VCL</span> <span class="pre">>=</span> <span class="pre">4.1</span></code></p> <blockquote> <div><p>Type: INT</p> <p>Readable from: client, backend</p> <p>Unique ID of this session.</p> </div></blockquote> </section> <section id="storage"> <h4>storage<a class="headerlink" href="#storage" title="Link to this heading">¶</a></h4> <p id="storage-free-space">storage.<name>.free_space</p> <blockquote> <div><p>Type: BYTES</p> <p>Readable from: client, backend</p> <p>Default: 0</p> <p>Free space available in the named stevedore. Only available for the malloc stevedore.</p> </div></blockquote> <p id="storage-happy">storage.<name>.happy</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: client, backend</p> <p>Default: true</p> <p>Health status for the named stevedore. Not available in any of the current stevedores.</p> </div></blockquote> <p id="storage-used-space">storage.<name>.used_space</p> <blockquote> <div><p>Type: BYTES</p> <p>Readable from: client, backend</p> <p>Default: 0</p> <p>Used space in the named stevedore. Only available for the malloc stevedore.</p> </div></blockquote> </section> <section id="protected-header-fields"> <span id="protected-headers"></span><h4>Protected header fields<a class="headerlink" href="#protected-header-fields" title="Link to this heading">¶</a></h4> <p>The <code class="docutils literal notranslate"><span class="pre">content-length</span></code> and <code class="docutils literal notranslate"><span class="pre">transfer-encoding</span></code> headers are read-only. They must be preserved to ensure HTTP/1 framing remains consistent and maintain a proper request and response synchronization with both clients and backends.</p> <p>VMODs can still update these headers, when there is a reason to change the framing, such as a transformation of a request or response body.</p> </section> <section id="http-response-status"> <h4>HTTP response status<a class="headerlink" href="#http-response-status" title="Link to this heading">¶</a></h4> <p>A HTTP status code has 3 digits XYZ where X must be between 1 and 5 included. Since it is not uncommon to see HTTP clients or servers relying on non-standard or even invalid status codes, Varnish can work with any status between 100 and 999.</p> <p>Within VCL code it is even possible to use status codes in the form VWXYZ as long as the overall value is lower than 65536, but only the XYZ part will be sent to the client, by which time the X must also have become non-zero.</p> <p>The VWXYZ form of status codes can be communicate extra information in <code class="docutils literal notranslate"><span class="pre">resp.status</span></code> and <code class="docutils literal notranslate"><span class="pre">beresp.status</span></code> to <code class="docutils literal notranslate"><span class="pre">return(synth(...))</span></code> and <code class="docutils literal notranslate"><span class="pre">return(error(...))</span></code>, to indicate which synthetic content to produce:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sub</span> <span class="n">vcl_recv</span> <span class="p">{</span> <span class="k">if</span> <span class="p">([</span><span class="o">...</span><span class="p">])</span> <span class="p">{</span> <span class="k">return</span> <span class="n">synth</span><span class="p">(</span><span class="mi">12404</span><span class="p">);</span> <span class="p">}</span> <span class="p">}</span> <span class="n">sub</span> <span class="n">vcl_synth</span> <span class="p">{</span> <span class="k">if</span> <span class="p">(</span><span class="n">resp</span><span class="o">.</span><span class="n">status</span> <span class="o">==</span> <span class="mi">12404</span><span class="p">)</span> <span class="p">{</span> <span class="p">[</span><span class="o">...</span><span class="p">]</span> <span class="o">//</span> <span class="n">this</span> <span class="n">specific</span> <span class="mi">404</span> <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">resp</span><span class="o">.</span><span class="n">status</span> <span class="o">%</span> <span class="mi">1000</span> <span class="o">==</span> <span class="mi">404</span><span class="p">)</span> <span class="p">{</span> <span class="p">[</span><span class="o">...</span><span class="p">]</span> <span class="o">//</span> <span class="nb">all</span> <span class="n">other</span> <span class="mi">404</span><span class="s1">'s</span> <span class="p">}</span> <span class="p">}</span> </pre></div> </div> <p>The <code class="docutils literal notranslate"><span class="pre">obj.status</span></code> variable will inherit the VWXYZ form, but in a ban expression only the XYZ part will be available. The VWXYZ form is strictly limited to VCL execution.</p> <p>Assigning an HTTP standardized code to <code class="docutils literal notranslate"><span class="pre">resp.status</span></code> or <code class="docutils literal notranslate"><span class="pre">beresp.status</span></code> will also set <code class="docutils literal notranslate"><span class="pre">resp.reason</span></code> or <code class="docutils literal notranslate"><span class="pre">beresp.reason</span></code> to the corresponding status message.</p> <section id="handling"> <h5>304 handling<a class="headerlink" href="#handling" title="Link to this heading">¶</a></h5> <p>For a 304 response, Varnish core code amends <code class="docutils literal notranslate"><span class="pre">beresp</span></code> before calling <cite>vcl_backend_response</cite>:</p> <ul class="simple"> <li><p>If the gzip status changed, <code class="docutils literal notranslate"><span class="pre">Content-Encoding</span></code> is unset and any <code class="docutils literal notranslate"><span class="pre">Etag</span></code> is weakened</p></li> <li><p>Any headers not present in the 304 response are copied from the existing cache object. <code class="docutils literal notranslate"><span class="pre">Content-Length</span></code> is copied if present in the existing cache object and discarded otherwise.</p></li> <li><p>The status gets set to 200.</p></li> </ul> <p><cite>beresp.was_304</cite> marks that this conditional response processing has happened.</p> <p>Note: Backend conditional requests are independent of client conditional requests, so clients may receive 304 responses no matter if a backend request was conditional.</p> </section> <section id="beresp-ttl-beresp-grace-beresp-keep"> <h5>beresp.ttl / beresp.grace / beresp.keep<a class="headerlink" href="#beresp-ttl-beresp-grace-beresp-keep" title="Link to this heading">¶</a></h5> <p>Before calling <cite>vcl_backend_response</cite>, core code sets <code class="docutils literal notranslate"><span class="pre">beresp.ttl</span></code> based on the response status and the response headers <code class="docutils literal notranslate"><span class="pre">Age</span></code>, <code class="docutils literal notranslate"><span class="pre">Cache-Control</span></code> or <code class="docutils literal notranslate"><span class="pre">Expires</span></code> and <code class="docutils literal notranslate"><span class="pre">Date</span></code> as follows:</p> <ul class="simple"> <li><p>If present and valid, the value of the <code class="docutils literal notranslate"><span class="pre">Age</span></code> header is effectively deduced from all ttl calculations.</p></li> <li><p>For status codes 200, 203, 204, 300, 301, 304, 404, 410 and 414:</p> <ul> <li><p>If <code class="docutils literal notranslate"><span class="pre">Cache-Control</span></code> contains an <code class="docutils literal notranslate"><span class="pre">s-maxage</span></code> or <code class="docutils literal notranslate"><span class="pre">max-age</span></code> field (in that order of preference), the ttl is set to the respective non-negative value or 0 if negative.</p></li> <li><p>Otherwise, if no <code class="docutils literal notranslate"><span class="pre">Expires</span></code> header exists, the default ttl is used.</p></li> <li><p>Otherwise, if <code class="docutils literal notranslate"><span class="pre">Expires</span></code> contains a time stamp before <code class="docutils literal notranslate"><span class="pre">Date</span></code>, the ttl is set to 0.</p></li> <li><p>Otherwise, if no <code class="docutils literal notranslate"><span class="pre">Date</span></code> header is present or the <code class="docutils literal notranslate"><span class="pre">Date</span></code> header timestamp differs from the local clock by no more than the <cite>clock_skew</cite> parameter, the ttl is set to</p> <ul> <li><p>0 if <code class="docutils literal notranslate"><span class="pre">Expires</span></code> denotes a past timestamp or</p></li> <li><p>the difference between the local clock and the <code class="docutils literal notranslate"><span class="pre">Expires</span></code> header otherwise.</p></li> </ul> </li> <li><p>Otherwise, the ttl is set to the difference between <code class="docutils literal notranslate"><span class="pre">Expires</span></code> and <code class="docutils literal notranslate"><span class="pre">Date</span></code></p></li> </ul> </li> <li><p>For status codes 302 and 307, the calculation is identical except that the default ttl is not used and -1 is returned if neither <code class="docutils literal notranslate"><span class="pre">Cache-Control</span></code> nor <code class="docutils literal notranslate"><span class="pre">Expires</span></code> exists.</p></li> <li><p>For all other status codes, ttl -1 is returned.</p></li> </ul> <p><code class="docutils literal notranslate"><span class="pre">beresp.grace</span></code> defaults to the <cite>default_grace</cite> parameter.</p> <p>For a non-negative ttl, if <code class="docutils literal notranslate"><span class="pre">Cache-Control</span></code> contains a <code class="docutils literal notranslate"><span class="pre">stale-while-revalidate</span></code> field value, <code class="docutils literal notranslate"><span class="pre">beresp.grace</span></code> is set to that value if non-negative or 0 otherwise.</p> <p><code class="docutils literal notranslate"><span class="pre">beresp.keep</span></code> defaults to the <cite>default_keep</cite> parameter.</p> </section> </section> </section> <section id="see-also"> <h3>SEE ALSO<a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h3> <ul class="simple"> <li><p><a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a></p></li> <li><p><a class="reference internal" href="vcl.html#vcl-7"><span class="std std-ref">VCL</span></a></p></li> </ul> </section> <section id="history"> <h3>HISTORY<a class="headerlink" href="#history" title="Link to this heading">¶</a></h3> <p>VCL was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS, Redpill Linpro and Varnish Software. This manual page is written by Per Buer, Poul-Henning Kamp, Martin Blix Grydeland, Kristian Lyngstøl, Lasse Karstensen and others.</p> </section> <section id="copyright"> <h3>COPYRIGHT<a class="headerlink" href="#copyright" title="Link to this heading">¶</a></h3> <p>This document is licensed under the same license as Varnish itself. See LICENSE for details.</p> <ul class="simple"> <li><p>Copyright (c) 2006 Verdens Gang AS</p></li> <li><p>Copyright (c) 2006-2021 Varnish Software AS</p></li> </ul> </section> </section> </section> <div class="clearer"></div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <div> <h3><a href="../index.html">Table of Contents</a></h3> <ul> <li><a class="reference internal" href="#">VCL-Variables</a><ul> <li><a class="reference internal" href="#the-complete-album">The complete album</a><ul> <li><a class="reference internal" href="#description">DESCRIPTION</a><ul> <li><a class="reference internal" href="#local-server-remote-and-client">local, server, remote and client</a></li> <li><a class="reference internal" href="#req-and-req-top">req and req_top</a></li> <li><a class="reference internal" href="#bereq">bereq</a></li> <li><a class="reference internal" href="#beresp">beresp</a></li> <li><a class="reference internal" href="#obj">obj</a></li> <li><a class="reference internal" href="#resp">resp</a></li> <li><a class="reference internal" href="#special-variables">Special variables</a></li> <li><a class="reference internal" href="#sess">sess</a></li> <li><a class="reference internal" href="#storage">storage</a></li> <li><a class="reference internal" href="#protected-header-fields">Protected header fields</a></li> <li><a class="reference internal" href="#http-response-status">HTTP response status</a><ul> <li><a class="reference internal" href="#handling">304 handling</a></li> <li><a class="reference internal" href="#beresp-ttl-beresp-grace-beresp-keep">beresp.ttl / beresp.grace / beresp.keep</a></li> </ul> </li> </ul> </li> <li><a class="reference internal" href="#see-also">SEE ALSO</a></li> <li><a class="reference internal" href="#history">HISTORY</a></li> <li><a class="reference internal" href="#copyright">COPYRIGHT</a></li> </ul> </li> </ul> </li> </ul> </div> <div> <h4>Previous topic</h4> <p class="topless"><a href="vcl.html" title="previous chapter">VCL</a></p> </div> <div> <h4>Next topic</h4> <p class="topless"><a href="vcl-step.html" title="next chapter">VCL-steps</a></p> </div> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/reference/vcl-var.rst.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3 id="searchlabel">Quick search</h3> <div class="searchformwrapper"> <form class="search" action="../search.html" method="get"> <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> <input type="submit" value="Go" /> </form> </div> </div> <script>document.getElementById('searchbox').style.display = "block"</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="vcl-step.html" title="VCL-steps" >next</a> |</li> <li class="right" > <a href="vcl.html" title="VCL" >previous</a> |</li> <li class="nav-item nav-item-0"><a href="../index.html">Varnish version 7.5.0 documentation</a> »</li> <li class="nav-item nav-item-1"><a href="index.html" >The Varnish Reference Manual</a> »</li> <li class="nav-item nav-item-this"><a href="">VCL-Variables</a></li> </ul> </div> <div class="footer" role="contentinfo"> © Copyright 2010-2014, Varnish Software AS. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6. </div> </body> </html>