VCL-Variables·续1
bereq.task_deadline
Type: DURATION
Readable from: vcl_pipe
Writable from: vcl_pipe
Unsettable from: vcl_pipe
Deadline for pipe sessions, defaults
0s, which falls back to thepipe_task_deadlineparameter, see varnishd
bereq.time
Type: TIME
Readable from: vcl_pipe, backend
The time when we started preparing the first backend request, remains constant across retries.
bereq.trace
Type: BOOL
Readable from: backend
Writable from: backend
Controls if
VCL_traceVSL records are emitted for the current request, see VSL.Inherits the value of
req.tracewhen the backend request is created. Does not get reset by a rollback.
bereq.uncacheable
Type: BOOL
Readable from: backend
Indicates whether this request is uncacheable due to a pass in the client side or a hit on an hit-for-pass object.
bereq.url
Type: STRING
Readable from: vcl_pipe, backend
Writable from: vcl_pipe, backend
The requested URL, copied from
req.url
bereq.xid
Type: INT
Readable from: vcl_pipe, backend
Unique ID of this request.
beresp#
The response received from the backend, one cache misses, the store object is built from beresp.
beresp
Type: HTTP
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
The entire backend response HTTP data structure, useful as argument to VMOD functions.
beresp.age
Type: DURATION
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Default: Age header, or zero.
The age of the object.
beresp.backend
Type: BACKEND
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
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.
beresp.backend.ip VCL <= 4.0
Type: IP
Readable from: vcl_backend_response
IP of the backend this response was fetched from.
beresp.backend.name
Type: STRING
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Name of the backend this response was fetched from. Same as beresp.backend.
beresp.body
Type: BODY
Writable from: vcl_backend_error
For producing a synthetic body.
beresp.do_esi
Type: BOOL
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Default:
false.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).
It is a VCL error to use beresp.do_esi after setting beresp.filters.
beresp.do_gunzip
Type: BOOL
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Default:
false.Set to
trueto gunzip the object while storing it in the cache.If
http_gzip_supportis disabled, setting this variable has no effect.It is a VCL error to use beresp.do_gunzip after setting beresp.filters.
beresp.do_gzip
Type: BOOL
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Default:
false.Set to
trueto gzip the object while storing it.If
http_gzip_supportis disabled, setting this variable has no effect.It is a VCL error to use beresp.do_gzip after setting beresp.filters.
beresp.do_stream
Type: BOOL
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Default:
true.Deliver the object to the client while fetching the whole object into varnish.
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.
This variable has no effect if beresp.do_esi is true or when the response body is empty.
beresp.filters
Type: STRING
Readable from: vcl_backend_response
Writable from: vcl_backend_response
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.
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.
The following VFP filters exist in varnish-cache:
gzip: compress a body using gziptestgunzip: Test if a body is valid gzip and refuse it otherwisegunzip: Uncompress gzip contentesi: ESI-process plain text contentesi_gzip: Save gzipped snippets for efficient ESI-processingThis 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.
Additional VFP filters are available from VMODs.
By default, beresp.filters is constructed as follows:
gunzipgets added for gzipped content ifberesp.do_gunziporberesp.do_esiare true.esi_gzipgets added ifberesp.do_esiis true together withberesp.do_gzipor content is already compressed.esigets added ifberesp.do_esiis truegzipgets added for uncompressed content ifberesp.do_gzipis truetestgunzipgets added for compressed content ifberesp.do_gunzipis false.After beresp.filters is set, using any of the beforementioned
beresp.do_*switches is a VCL error.
beresp.grace
Type: DURATION
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Default: Cache-Control
stale-while-revalidatedirective, ordefault_graceparameter.Set to a period to enable grace.
beresp.http.*
Type: HEADER
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Unsettable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
The HTTP headers returned from the server.
See req.http for general notes.
beresp.http.content-length
Type: HEADER
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
The content-length header field is protected, see protected_headers.
beresp.http.transfer-encoding
Type: HEADER
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
The transfer-encoding header field is protected, see protected_headers.
beresp.keep
Type: DURATION
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Default:
default_keepparameter.Set to a period to enable conditional backend requests.
The keep time is cache lifetime in addition to the ttl.
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.
beresp.proto VCL <= 4.0
Type: STRING
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
The HTTP protocol version the backend replied with.
beresp.proto VCL >= 4.1
Type: STRING
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
The HTTP protocol version the backend replied with.
beresp.reason
Type: STRING
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
The HTTP status message returned by the server.
beresp.status
Type: INT
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
The HTTP status code returned by the server.
More information in the HTTP response status section.
beresp.storage
Type: STEVEDORE
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
The storage backend to use to save this object. If none is set, Varnish will pick a storage backend in a round-robin fashion, or the Transient backend if the object is short-lived.
beresp.storage_hint VCL <= 4.0
Type: STRING
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Deprecated since varnish 5.1 and discontinued since VCL 4.1 (varnish 6.0). Use beresp.storage instead.
Hint to Varnish that you want to save this object to a particular storage backend.
beresp.time
Type: TIME
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
When the backend headers were fully received just before
vcl_backend_response {}was entered, or whenvcl_backend_error {}was entered.
beresp.transit_buffer
Type: BYTES
Readable from: vcl_backend_response
Writable from: vcl_backend_response
Default:
transit_bufferparameter, see varnishd.The maximum number of bytes the client can be ahead of the backend during a streaming pass if
berespis uncacheable. See alsotransit_bufferparameter documentation in varnishd.
beresp.ttl
Type: DURATION
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Default: Cache-Control
s-maxageormax-agedirectives, or a value computed from the Expires header’s deadline, or thedefault_ttlparameter.The object’s remaining time to live, in seconds.
beresp.uncacheable
Type: BOOL
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Writable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
Inherited from bereq.uncacheable, see there.
Setting this variable makes the object uncacheable.
This may produce a hit-for-miss object in the cache.
Clearing the variable has no effect and will log the warning “Ignoring attempt to reset beresp.uncacheable”.
beresp.was_304
Type: BOOL
Readable from: vcl_backend_response, vcl_backend_error, vcl_backend_refresh
When
truethis indicates that we got a 304 response to our conditional fetch from the backend and turned that intoberesp.status = 200
obj_stale#
This is the stale object we had in cache. It cannot be modified.
obj_stale.age
Type: DURATION
Readable from: vcl_backend_refresh
The age of the stale object.
obj_stale.can_esi
Type: BOOL
Readable from: vcl_backend_refresh
If the stale object can be ESI processed, that is if setting
resp.do_esior addingesitoresp.filtersinvcl_deliver {}would cause the response body to be ESI processed.
obj_stale.grace
Type: DURATION
Readable from: vcl_backend_refresh
The stale object’s grace period in seconds.
obj_stale.hits
Type: INT
Readable from: vcl_backend_refresh
The count of cache-hits on this stale object.
In vcl_deliver a value of 0 indicates a cache miss.
obj_stale.http.*
Type: HEADER
Readable from: vcl_backend_refresh
The HTTP headers stored in the stale object.
See req.http for general notes.
obj_stale.keep
Type: DURATION
Readable from: vcl_backend_refresh
The stale object’s keep period in seconds.
obj_stale.proto
Type: STRING
Readable from: vcl_backend_refresh
The HTTP protocol version stored in the stale object.
obj_stale.reason
Type: STRING
Readable from: vcl_backend_refresh
The HTTP reason phrase stored in the stale object.
obj_stale.status
Type: INT
Readable from: vcl_backend_refresh
The HTTP status code stored in the stale object.
More information in the HTTP response status section.
obj_stale.storage
Type: STEVEDORE
Readable from: vcl_backend_refresh
The storage backend where this stale object is stored.
obj_stale.time
Type: TIME
Readable from: vcl_backend_refresh
The time the stale object was created from the perspective of the server which generated it. This will roughly be equivalent to
now-obj.age.
obj_stale.ttl
Type: DURATION
Readable from: vcl_backend_refresh
The stale object’s time to live, in seconds.
obj_stale.uncacheable
Type: BOOL
Readable from: vcl_backend_refresh
Whether the stale object is uncacheable (pass, hit-for-pass or hit-for-miss).
obj_stale.is_valid
Type: BOOL
Readable from: vcl_backend_refresh
Whether the stale object is still valid.
obj#
This is the object we found in cache. It cannot be modified.
obj.age
Type: DURATION
Readable from: vcl_hit, vcl_deliver
The age of the object.
obj.can_esi
Type: BOOL
Readable from: vcl_hit, vcl_deliver
If the object can be ESI processed, that is if setting
resp.do_esior addingesitoresp.filtersinvcl_deliver {}would cause the response body to be ESI processed.
obj.grace
Type: DURATION
Readable from: vcl_hit, vcl_deliver
The object’s grace period in seconds.
obj.hits
Type: INT
Readable from: vcl_hit, vcl_deliver
The count of cache-hits on this object.
In vcl_deliver a value of 0 indicates a cache miss.
obj.http.*
Type: HEADER
Readable from: vcl_hit
The HTTP headers stored in the object.
See req.http for general notes.
obj.keep
Type: DURATION
Readable from: vcl_hit, vcl_deliver
The object’s keep period in seconds.
obj.proto
Type: STRING
Readable from: vcl_hit
The HTTP protocol version stored in the object.
obj.reason
Type: STRING
Readable from: vcl_hit
The HTTP reason phrase stored in the object.
obj.status
Type: INT
Readable from: vcl_hit
The HTTP status code stored in the object.
More information in the HTTP response status section.
obj.storage
Type: STEVEDORE
Readable from: vcl_hit, vcl_deliver
The storage backend where this object is stored.
obj.time
Type: TIME
Readable from: vcl_hit, vcl_deliver
The time the object was created from the perspective of the server which generated it. This will roughly be equivalent to
now-obj.age.
obj.ttl
Type: DURATION
Readable from: vcl_hit, vcl_deliver
The object’s remaining time to live, in seconds.
obj.uncacheable
Type: BOOL
Readable from: vcl_deliver
Whether the object is uncacheable (pass, hit-for-pass or hit-for-miss).
resp#
This is the response we send to the client, it is built from either beresp (pass/miss), obj (hits) or created from whole cloth (synth).
With the exception of resp.body all resp.* variables available in both vcl_deliver{} and vcl_synth{} as a matter of symmetry.
resp
Type: HTTP
Readable from: vcl_deliver, vcl_synth
The entire response HTTP data structure, useful as argument to VMODs.
