File manager - Edit - /usr/share/doc/varnish/html/reference/vcl-var.html
Back
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>VCL-Variables — Varnish version 7.1.1 documentation</title> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../_static/classic.css" type="text/css" /> <script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script src="../_static/jquery.js"></script> <script src="../_static/underscore.js"></script> <script src="../_static/doctools.js"></script> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="VCL-backends" href="vcl-backend.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-backend.html" title="VCL-backends" 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.1.1 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"> <div class="section" id="vcl-variables"> <span id="vcl-var-7"></span><h1>VCL-Variables<a class="headerlink" href="#vcl-variables" title="Permalink to this headline">¶</a></h1> <div class="section" id="the-complete-album"> <h2>The complete album<a class="headerlink" href="#the-complete-album" title="Permalink to this headline">¶</a></h2> <dl class="field-list simple"> <dt class="field-odd">Manual section</dt> <dd class="field-odd"><p>7</p> </dd> </dl> <div class="section" id="description"> <h3>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline">¶</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> <div class="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="Permalink to this headline">¶</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>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>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>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>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>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>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>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>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>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> </div> <div class="section" id="req-and-req-top"> <h4>req and req_top<a class="headerlink" href="#req-and-req-top" title="Permalink to this headline">¶</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>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>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>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>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>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>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>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>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>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>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> </div></blockquote> <p>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>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>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>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>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>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>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>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>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>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>req.xid</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: client</p> <p>Unique ID of this request.</p> </div></blockquote> <p>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 <code class="docutils literal notranslate"><span class="pre">req.http.*</span></code> for general notes.</p> </div></blockquote> <p>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>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>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>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> </div> <div class="section" id="bereq"> <h4>bereq<a class="headerlink" href="#bereq" title="Permalink to this headline">¶</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>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>bereq.between_bytes_timeout</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: backend</p> <p>Writable from: 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>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 <code class="docutils literal notranslate"><span class="pre">bereq.http.Content-Length</span></code>.</p> </div></blockquote> <p>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>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>bereq.first_byte_timeout</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: backend</p> <p>Writable from: 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>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>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 <code class="docutils literal notranslate"><span class="pre">req.http.*</span></code> for general notes.</p> </div></blockquote> <p>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>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>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>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>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>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>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>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>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>bereq.xid</p> <blockquote> <div><p>Type: STRING</p> <p>Readable from: vcl_pipe, backend</p> <p>Unique ID of this request.</p> </div></blockquote> </div> <div class="section" id="beresp"> <h4>beresp<a class="headerlink" href="#beresp" title="Permalink to this headline">¶</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>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>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>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>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>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>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>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>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>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>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>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 <code class="docutils literal notranslate"><span class="pre">req.http.*</span></code> for general notes.</p> </div></blockquote> <p>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>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>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>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>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>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>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>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>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> </div> <div class="section" id="obj"> <h4>obj<a class="headerlink" href="#obj" title="Permalink to this headline">¶</a></h4> <p>This is the object we found in cache. It cannot be modified.</p> <p>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>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>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>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>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 <code class="docutils literal notranslate"><span class="pre">req.http.*</span></code> for general notes.</p> </div></blockquote> <p>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>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>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>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>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>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>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>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> </div> <div class="section" id="resp"> <h4>resp<a class="headerlink" href="#resp" title="Permalink to this headline">¶</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>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>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>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>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 <code class="docutils literal notranslate"><span class="pre">req.http.*</span></code> for general notes.</p> </div></blockquote> <p>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>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>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>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, 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>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> </div> <div class="section" id="special-variables"> <h4>Special variables<a class="headerlink" href="#special-variables" title="Permalink to this headline">¶</a></h4> <p>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> </div></blockquote> </div> <div class="section" id="sess"> <h4>sess<a class="headerlink" href="#sess" title="Permalink to this headline">¶</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>sess.idle_send_timeout</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: client</p> <p>Writable 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>sess.send_timeout</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: client</p> <p>Writable 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>sess.timeout_idle</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: client</p> <p>Writable 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>sess.timeout_linger</p> <blockquote> <div><p>Type: DURATION</p> <p>Readable from: client</p> <p>Writable 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>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: STRING</p> <p>Readable from: client, backend</p> <p>Unique ID of this session.</p> </div></blockquote> </div> <div class="section" id="storage"> <h4>storage<a class="headerlink" href="#storage" title="Permalink to this headline">¶</a></h4> <p>storage.<name>.free_space</p> <blockquote> <div><p>Type: BYTES</p> <p>Readable from: client, backend</p> <p>Free space available in the named stevedore. Only available for the malloc stevedore.</p> </div></blockquote> <p>storage.<name>.happy</p> <blockquote> <div><p>Type: BOOL</p> <p>Readable from: client, backend</p> <p>Health status for the named stevedore. Not available in any of the current stevedores.</p> </div></blockquote> <p>storage.<name>.used_space</p> <blockquote> <div><p>Type: BYTES</p> <p>Readable from: client, backend</p> <p>Used space in the named stevedore. Only available for the malloc stevedore.</p> </div></blockquote> <div class="section" id="http-response-status"> <h5>HTTP response status<a class="headerlink" href="#http-response-status" title="Permalink to this headline">¶</a></h5> <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> </div> </div> </div> <div class="section" id="see-also"> <h3>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</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> </div> <div class="section" id="history"> <h3>HISTORY<a class="headerlink" href="#history" title="Permalink to this headline">¶</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> </div> <div class="section" id="copyright"> <h3>COPYRIGHT<a class="headerlink" href="#copyright" title="Permalink to this headline">¶</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> </div> </div> </div> <div class="clearer"></div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <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><ul> <li><a class="reference internal" href="#http-response-status">HTTP response status</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> <h4>Previous topic</h4> <p class="topless"><a href="vcl.html" title="previous chapter">VCL</a></p> <h4>Next topic</h4> <p class="topless"><a href="vcl-backend.html" title="next chapter">VCL-backends</a></p> <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" /> <input type="submit" value="Go" /> </form> </div> </div> <script>$('#searchbox').show(0);</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-backend.html" title="VCL-backends" >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.1.1 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> 3.4.3. </div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings