1VCL-VARIABLES(7)                                              VCL-VARIABLES(7)
2
3
4

NAME

6       VCL-Variables - The complete album
7

DESCRIPTION

9       This is a list of all variables in the VCL language.
10
11       Variable names take the form scope.variable[.index], for instance:
12
13          req.url
14          beresp.http.date
15          client.ip
16
17       Which  operations are possible on each variable is described below, of‐
18       ten with the shorthand "backend" which covers the vcl_backend_* {} sub‐
19       routines  and  "client"  which  covers the rest, except vcl_init {} and
20       vcl_fini {}.
21
22   local, server, remote and client
23       These variables describe the network connection between the client  and
24       varnishd.
25
26       Without PROXY protocol:
27
28               client    server
29               remote    local
30                 v          v
31          CLIENT ------------ VARNISHD
32
33       With PROXY protocol:
34
35               client    server   remote     local
36                 v          v       v          v
37          CLIENT ------------ PROXY ------------ VARNISHD
38
39       local.ip
40          Type: IP
41
42          Readable from: client, backend
43
44          The IP address (and port number) of the local end of the TCP connec‐
45          tion, for instance 192.168.1.1:81
46
47          If the connection is  a  UNIX  domain  socket,  the  value  will  be
48          0.0.0.0:0
49
50       local.endpoint  VCL >= 4.1
51          Type: STRING
52
53          Readable from: client, backend
54
55          The address of the '-a' socket the session was accepted on.
56
57          If the argument was -a foo=:81 this would be ":81"
58
59       local.socket    VCL >= 4.1
60          Type: STRING
61
62          Readable from: client, backend
63
64          The name of the '-a' socket the session was accepted on.
65
66          If the argument was -a foo=:81 this would be "foo".
67
68          Note that all '-a' gets a default name on the form a%d if no name is
69          provided.
70
71       remote.ip
72          Type: IP
73
74          Readable from: client, backend
75
76          The IP address of the other end of the TCP connection.  This can ei‐
77          ther be the clients IP, or the outgoing IP of a proxy server.
78
79          If  the  connection  is  a  UNIX  domain  socket,  the value will be
80          0.0.0.0:0
81
82       client.ip
83          Type: IP
84
85          Readable from: client, backend
86
87          The client's IP address, either the same as remote.ip  or  what  the
88          PROXY protocol told us.
89
90       client.identity
91          Type: STRING
92
93          Readable from: client, backend
94
95          Writable from: client
96
97          Identification of the client, used to load balance in the client di‐
98          rector.  Defaults to client.ip
99
100          This variable can be overwritten with more precise information,  for
101          instance extracted from a Cookie: header.
102
103       server.ip
104          Type: IP
105
106          Readable from: client, backend
107
108          The  IP address of the socket on which the client connection was re‐
109          ceived, either the same as server.ip or what the PROXY protocol told
110          us.
111
112       server.hostname
113          Type: STRING
114
115          Readable from: all
116
117          The  host name of the server, as returned by the gethostname(3) sys‐
118          tem function.
119
120       server.identity
121          Type: STRING
122
123          Readable from: all
124
125          The identity of the server, as set by the -i parameter.
126
127          If an -i parameter is not passed to varnishd, the return value  from
128          gethostname(3) system function will be used.
129
130   req and req_top
131       These  variables describe the present request, and when ESI:include re‐
132       quests are being processed, req_top points to the request received from
133       the client.
134
135       req
136          Type: HTTP
137
138          Readable from: client
139
140          The  entire  request HTTP data structure.  Mostly useful for passing
141          to VMODs.
142
143       req.method
144          Type: STRING
145
146          Readable from: client
147
148          Writable from: client
149
150          The request method (e.g. "GET", "HEAD", ...)
151
152       req.hash
153          Type: BLOB
154
155          Readable from: vcl_hit, vcl_miss, vcl_pass, vcl_purge, vcl_deliver
156
157          The hash key of this request.  Mostly useful for passing  to  VMODs,
158          but can also be useful for debugging hit/miss status.
159
160       req.url
161          Type: STRING
162
163          Readable from: client
164
165          Writable from: client
166
167          The requested URL, for instance "/robots.txt".
168
169       req.proto       VCL <= 4.0
170          Type: STRING
171
172          Readable from: client
173
174          Writable from: client
175
176          The  HTTP protocol version used by the client, usually "HTTP/1.1" or
177          "HTTP/2.0".
178
179       req.proto       VCL >= 4.1
180          Type: STRING
181
182          Readable from: client
183
184          The HTTP protocol version used by the client, usually "HTTP/1.1"  or
185          "HTTP/2.0".
186
187       req.http.*
188          Type: HEADER
189
190          Readable from: client
191
192          Writable from: client
193
194          Unsetable from: client
195
196          The headers of request, things like req.http.date.
197
198          The RFCs allow multiple headers with the same name, and both set and
199          unset will remove all headers with the name given.
200
201          The header name * is a VCL symbol and as such cannot,  for  example,
202          start with a numeral. Custom VMODs exist for handling of such header
203          names.
204
205       req.restarts
206          Type: INT
207
208          Readable from: client
209
210          A count of how many times this request has been restarted.
211
212       req.storage
213          Type: STEVEDORE
214
215          Readable from: client
216
217          Writable from: client
218
219          The storage backend to use to save this request body.
220
221       req.esi_level
222          Type: INT
223
224          Readable from: client
225
226          A count of how many levels of ESI requests we're currently at.
227
228       req.ttl
229          Type: DURATION
230
231          Readable from: client
232
233          Writable from: client
234
235          Upper limit on the object age for cache lookups to return hit.
236
237       req.grace
238          Type: DURATION
239
240          Readable from: client
241
242          Writable from: client
243
244          Upper limit on the object grace.
245
246          During lookup the minimum of req.grace and the object's stored grace
247          value will be used as the object's grace.
248
249       req.xid
250          Type: STRING
251
252          Readable from: client
253
254          Unique ID of this request.
255
256       req.esi VCL <= 4.0
257          Type: BOOL
258
259          Readable from: client
260
261          Writable from: client
262
263          Set  to  false  to disable ESI processing regardless of any value in
264          beresp.do_esi. Defaults  to  true.  This  variable  is  replaced  by
265          resp.do_esi in VCL 4.1.
266
267       req.can_gzip
268          Type: BOOL
269
270          Readable from: client
271
272          True  if  the  client provided gzip or x-gzip in the Accept-Encoding
273          header.
274
275       req.backend_hint
276          Type: BACKEND
277
278          Readable from: client
279
280          Writable from: client
281
282          Set bereq.backend to this if we attempt to fetch.  When set to a di‐
283          rector,  reading  this variable returns an actual backend if the di‐
284          rector has resolved immediately, or the  director  otherwise.   When
285          used in string context, returns the name of the director or backend,
286          respectively.
287
288       req.hash_ignore_busy
289          Type: BOOL
290
291          Readable from: client
292
293          Writable from: client
294
295          Default: false.
296
297          Ignore any busy object during cache lookup.
298
299          You only want to do this when you have two server looking up content
300          sideways from each other to avoid deadlocks.
301
302       req.hash_always_miss
303          Type: BOOL
304
305          Readable from: client
306
307          Writable from: client
308
309          Default: false.
310
311          Force a cache miss for this request, even if perfectly good matching
312          objects are in the cache.
313
314          This is useful to force-update the cache without invalidating exist‐
315          ing entries in case the fetch fails.
316
317       req.is_hitmiss
318          Type: BOOL
319
320          Readable from: client
321
322          If this request resulted in a hitmiss
323
324       req.is_hitpass
325          Type: BOOL
326
327          Readable from: client
328
329          If this request resulted in a hitpass
330
331       req_top.method
332          Type: STRING
333
334          Readable from: client
335
336          The  request  method  of  the top-level request in a tree of ESI re‐
337          quests. (e.g. "GET", "HEAD").  Identical to  req.method  in  non-ESI
338          requests.
339
340       req_top.url
341          Type: STRING
342
343          Readable from: client
344
345          The  requested  URL  of  the  top-level request in a tree of ESI re‐
346          quests.  Identical to req.url in non-ESI requests.
347
348       req_top.http.*
349          Type: HEADER
350
351          Readable from: client
352
353          HTTP headers of the top-level request in a  tree  of  ESI  requests.
354          Identical to req.http. in non-ESI requests.
355
356          See req.http.* for general notes.
357
358       req_top.proto
359          Type: STRING
360
361          Readable from: client
362
363          HTTP  protocol version of the top-level request in a tree of ESI re‐
364          quests.  Identical to req.proto in non-ESI requests.
365
366   bereq
367       This is the request we send to  the  backend,  it  is  built  from  the
368       clients req.* fields by filtering out "per-hop" fields which should not
369       be passed along (Connection:, Range: and similar).
370
371       Slightly more fields are allowed through for  pass`  fetches  than  for
372       `miss` fetches, for instance ``Range.
373
374       bereq
375          Type: HTTP
376
377          Readable from: backend
378
379          The  entire  backend  request HTTP data structure.  Mostly useful as
380          argument to VMODs.
381
382       bereq.xid
383          Type: STRING
384
385          Readable from: vcl_pipe, backend
386
387          Unique ID of this request.
388
389       bereq.retries
390          Type: INT
391
392          Readable from: backend
393
394          A count of how many times this request has been retried.
395
396       bereq.backend
397          Type: BACKEND
398
399          Readable from: vcl_pipe, backend
400
401          Writable from: vcl_pipe, backend
402
403          This is the backend or director we attempt to fetch from.  When  set
404          to  a  director,  reading this variable returns an actual backend if
405          the director has resolved immediately, or  the  director  otherwise.
406          When  used  in  string  context, returns the name of the director or
407          backend, respectively.
408
409       bereq.body
410          Type: BODY
411
412          Unsetable from: vcl_backend_fetch
413
414          The request body.
415
416          Unset will also remove bereq.http.Content-Length.
417
418       bereq.hash
419          Type: BLOB
420
421          Readable from: vcl_pipe, backend
422
423          The hash key of this request, a copy of req.hash.
424
425       bereq.method
426          Type: STRING
427
428          Readable from: vcl_pipe, backend
429
430          Writable from: vcl_pipe, backend
431
432          The request type (e.g. "GET", "HEAD").
433
434          Regular (non-pipe, non-pass) fetches are always "GET"
435
436       bereq.url
437          Type: STRING
438
439          Readable from: vcl_pipe, backend
440
441          Writable from: vcl_pipe, backend
442
443          The requested URL, copied from req.url
444
445       bereq.proto     VCL <= 4.0
446          Type: STRING
447
448          Readable from: vcl_pipe, backend
449
450          Writable from: vcl_pipe, backend
451
452          The HTTP protocol version, "HTTP/1.1" unless a pass or pipe  request
453          has "HTTP/1.0" in req.proto
454
455       bereq.proto     VCL >= 4.1
456          Type: STRING
457
458          Readable from: vcl_pipe, backend
459
460          The  HTTP protocol version, "HTTP/1.1" unless a pass or pipe request
461          has "HTTP/1.0" in req.proto
462
463       bereq.http.*
464          Type: HEADER
465
466          Readable from: vcl_pipe, backend
467
468          Writable from: vcl_pipe, backend
469
470          Unsetable from: vcl_pipe, backend
471
472          The headers to be sent to the backend.
473
474          See req.http.* for general notes.
475
476       bereq.uncacheable
477          Type: BOOL
478
479          Readable from: backend
480
481          Indicates whether this request is uncacheable due to a pass  in  the
482          client side or a hit on an hit-for-pass object.
483
484       bereq.connect_timeout
485          Type: DURATION
486
487          Readable from: vcl_pipe, backend
488
489          Writable from: vcl_pipe, backend
490
491          Default:  .connect_timeout  attribute  from  the backend_definition,
492          which defaults to the connect_timeout parameter, see varnishd(1).
493
494          The time in seconds to wait for a backend connection  to  be  estab‐
495          lished.
496
497       bereq.first_byte_timeout
498          Type: DURATION
499
500          Readable from: backend
501
502          Writable from: backend
503
504          Default:  .first_byte_timeout attribute from the backend_definition,
505          which defaults to the first_byte_timeout parameter, see varnishd(1).
506
507          The time in seconds to wait getting the first  byte  back  from  the
508          backend.  Not available in pipe mode.
509
510       bereq.between_bytes_timeout
511          Type: DURATION
512
513          Readable from: backend
514
515          Writable from: backend
516
517          Default:  .between_bytes_timeout  attribute from the backend_defini‐
518          tion, which defaults to  the  between_bytes_timeout  parameter,  see
519          varnishd(1).
520
521          The  time  in  seconds  to  wait between each received byte from the
522          backend.  Not available in pipe mode.
523
524       bereq.is_bgfetch
525          Type: BOOL
526
527          Readable from: backend
528
529          True for fetches where the client got a hit on an object  in  grace,
530          and this fetch was kicked of in the background to get a fresh copy.
531
532       bereq.is_hitmiss
533          Type: BOOL
534
535          Readable from: backend
536
537          If this backend request was caused by a hitmiss.
538
539       bereq.is_hitpass
540          Type: BOOL
541
542          Readable from: backend
543
544          If this backend request was caused by a hitpass.
545
546   beresp
547       The response received from the backend, one cache misses, the store ob‐
548       ject is built from beresp.
549
550       beresp
551          Type: HTTP
552
553          Readable from: vcl_backend_response, vcl_backend_error
554
555          The entire backend response HTTP data structure, useful as  argument
556          to VMOD functions.
557
558       beresp.body
559          Type: BODY
560
561          Writable from: vcl_backend_error
562
563          For producing a synthetic body.
564
565       beresp.proto    VCL <= 4.0
566          Type: STRING
567
568          Readable from: vcl_backend_response, vcl_backend_error
569
570          Writable from: vcl_backend_response, vcl_backend_error
571
572          The HTTP protocol version the backend replied with.
573
574       beresp.proto    VCL >= 4.1
575          Type: STRING
576
577          Readable from: vcl_backend_response, vcl_backend_error
578
579          The HTTP protocol version the backend replied with.
580
581       beresp.status
582          Type: INT
583
584          Readable from: vcl_backend_response, vcl_backend_error
585
586          Writable from: vcl_backend_response, vcl_backend_error
587
588          The HTTP status code returned by the server.
589
590          More information in the HTTP response status section.
591
592       beresp.reason
593          Type: STRING
594
595          Readable from: vcl_backend_response, vcl_backend_error
596
597          Writable from: vcl_backend_response, vcl_backend_error
598
599          The HTTP status message returned by the server.
600
601       beresp.http.*
602          Type: HEADER
603
604          Readable from: vcl_backend_response, vcl_backend_error
605
606          Writable from: vcl_backend_response, vcl_backend_error
607
608          Unsetable from: vcl_backend_response, vcl_backend_error
609
610          The HTTP headers returned from the server.
611
612          See req.http.* for general notes.
613
614       beresp.do_esi
615          Type: BOOL
616
617          Readable from: vcl_backend_response, vcl_backend_error
618
619          Writable from: vcl_backend_response, vcl_backend_error
620
621          Default: false.
622
623          Set it to true to parse the object for ESI directives.  Will only be
624          honored if req.esi is true.
625
626          It is a VCL error to use beresp.do_esi after setting beresp.filters.
627
628       beresp.do_stream
629          Type: BOOL
630
631          Readable from: vcl_backend_response, vcl_backend_error
632
633          Writable from: vcl_backend_response, vcl_backend_error
634
635          Default: true.
636
637          Deliver the object to the client while  fetching  the  whole  object
638          into varnish.
639
640          For  uncacheable  objects,  storage for parts of the body which have
641          been sent to the client may get freed early, depending on the  stor‐
642          age engine used.
643
644          This  variable  has no effect if do_esi is true or when the response
645          body is empty.
646
647       beresp.do_gzip
648          Type: BOOL
649
650          Readable from: vcl_backend_response, vcl_backend_error
651
652          Writable from: vcl_backend_response, vcl_backend_error
653
654          Default: false.
655
656          Set to true to gzip the object while storing it.
657
658          If http_gzip_support is disabled, setting this variable has  no  ef‐
659          fect.
660
661          It  is  a  VCL error to use beresp.do_gzip after setting beresp.fil‐
662          ters.
663
664       beresp.do_gunzip
665          Type: BOOL
666
667          Readable from: vcl_backend_response, vcl_backend_error
668
669          Writable from: vcl_backend_response, vcl_backend_error
670
671          Default: false.
672
673          Set to true to gunzip the object while storing it in the cache.
674
675          If http_gzip_support is disabled, setting this variable has  no  ef‐
676          fect.
677
678          It  is a VCL error to use beresp.do_gunzip after setting beresp.fil‐
679          ters.
680
681       beresp.was_304
682          Type: BOOL
683
684          Readable from: vcl_backend_response, vcl_backend_error
685
686          When true this indicates that we got a 304 response  to  our  condi‐
687          tional  fetch  from the backend and turned that into beresp.status =
688          200
689
690       beresp.uncacheable
691          Type: BOOL
692
693          Readable from: vcl_backend_response, vcl_backend_error
694
695          Writable from: vcl_backend_response, vcl_backend_error
696
697          Inherited from bereq.uncacheable, see there.
698
699          Setting this variable makes the object uncacheable.
700
701          This may may produce a hit-for-miss object in the cache.
702
703          Clearing the variable has no effect and will log the warning "Ignor‐
704          ing attempt to reset beresp.uncacheable".
705
706       beresp.ttl
707          Type: DURATION
708
709          Readable from: vcl_backend_response, vcl_backend_error
710
711          Writable from: vcl_backend_response, vcl_backend_error
712
713          Default:  Cache-Control  s-maxage  or max-age directives, or a value
714          computed from the Expires header's deadline, or the default_ttl  pa‐
715          rameter.
716
717          The object's remaining time to live, in seconds.
718
719       beresp.age
720          Type: DURATION
721
722          Readable from: vcl_backend_response, vcl_backend_error
723
724          Default: Age header, or zero.
725
726          The age of the object.
727
728       beresp.grace
729          Type: DURATION
730
731          Readable from: vcl_backend_response, vcl_backend_error
732
733          Writable from: vcl_backend_response, vcl_backend_error
734
735          Default:  Cache-Control  stale-while-revalidate  directive,  or  de‐
736          fault_grace parameter.
737
738          Set to a period to enable grace.
739
740       beresp.keep
741          Type: DURATION
742
743          Readable from: vcl_backend_response, vcl_backend_error
744
745          Writable from: vcl_backend_response, vcl_backend_error
746
747          Default: default_keep parameter.
748
749          Set to a period to enable conditional backend requests.
750
751          The keep time is cache lifetime in addition to the ttl.
752
753          Objects with ttl expired but with keep time left may be used to  is‐
754          sue  conditional (If-Modified-Since / If-None-Match) requests to the
755          backend to refresh them.
756
757       beresp.backend
758          Type: BACKEND
759
760          Readable from: vcl_backend_response, vcl_backend_error
761
762          This is the backend we fetched from.  If bereq.backend was set to  a
763          director,  this  will be the backend selected by the director.  When
764          used in string context, returns its name.
765
766       beresp.backend.name
767          Type: STRING
768
769          Readable from: vcl_backend_response, vcl_backend_error
770
771          Name of the  backend  this  response  was  fetched  from.   Same  as
772          beresp.backend.
773
774       beresp.backend.ip       VCL <= 4.0
775          Type: IP
776
777          Readable from: vcl_backend_response
778
779          IP of the backend this response was fetched from.
780
781       beresp.storage
782          Type: STEVEDORE
783
784          Readable from: vcl_backend_response, vcl_backend_error
785
786          Writable from: vcl_backend_response, vcl_backend_error
787
788          The storage backend to use to save this object.
789
790       beresp.storage_hint     VCL <= 4.0
791          Type: STRING
792
793          Readable from: vcl_backend_response, vcl_backend_error
794
795          Writable from: vcl_backend_response, vcl_backend_error
796
797          Deprecated since varnish 5.1 and discontinued since VCL 4.1 (varnish
798          6.0). Use beresp.storage instead.
799
800          Hint to Varnish that you want to save this object  to  a  particular
801          storage backend.
802
803       beresp.filters
804          Type: STRING
805
806          Readable from: vcl_backend_response
807
808          Writable from: vcl_backend_response
809
810          List  of  Varnish Fetch Processor (VFP) filters the beresp.body will
811          be pulled through. The order left to right signifies processing from
812          backend  to  cache, iow the leftmost filter is run first on the body
813          as received from the backend after decoding of any  transfer  encod‐
814          ings.
815
816          VFP Filters change the body before going into the cache and/or being
817          handed to the client side, where  it  may  get  processed  again  by
818          resp.filters.
819
820          The following VFP filters exist in varnish-cache:
821
822gzip: compress a body using gzip
823
824testgunzip: Test if a body is valid gzip and refuse it otherwise
825
826gunzip: Uncompress gzip content
827
828esi: ESI-process plain text content
829
830esi_gzip: Save gzipped snippets for efficient ESI-processing
831
832            This  filter  enables  stitching  together  ESI  from individually
833            gzipped fragments, saving processing power for  re-compression  on
834            the client side at the expense of some compression efficiency.
835
836          Additional VFP filters are available from VMODs.
837
838          By default, beresp.filters is constructed as follows:
839
840gunzip  gets  added  for  gzipped  content  if beresp.do_gunzip or
841            beresp.do_esi are true.
842
843esi_gzip  gets  added  if  beresp.do_esi  is  true  together  with
844            beresp.do_gzip or content is already compressed.
845
846esi gets added if beresp.do_esi is true
847
848gzip gets added for uncompressed content if beresp.do_gzip is true
849
850testgunzip  gets  added for compressed content if beresp.do_gunzip
851            is false.
852
853          After beresp.filters  is  set,  using  any  of  the  beforementioned
854          beresp.do_* switches is a VCL error.
855
856   obj
857       This is the object we found in cache.  It cannot be modified.
858
859       obj.proto
860          Type: STRING
861
862          Readable from: vcl_hit
863
864          The HTTP protocol version stored in the object.
865
866       obj.status
867          Type: INT
868
869          Readable from: vcl_hit
870
871          The HTTP status code stored in the object.
872
873          More information in the HTTP response status section.
874
875       obj.reason
876          Type: STRING
877
878          Readable from: vcl_hit
879
880          The HTTP reason phrase stored in the object.
881
882       obj.hits
883          Type: INT
884
885          Readable from: vcl_hit, vcl_deliver
886
887          The count of cache-hits on this object.
888
889          In vcl_deliver a value of 0 indicates a cache miss.
890
891       obj.http.*
892          Type: HEADER
893
894          Readable from: vcl_hit
895
896          The HTTP headers stored in the object.
897
898          See req.http.* for general notes.
899
900       obj.ttl
901          Type: DURATION
902
903          Readable from: vcl_hit, vcl_deliver
904
905          The object's remaining time to live, in seconds.
906
907       obj.age
908          Type: DURATION
909
910          Readable from: vcl_hit, vcl_deliver
911
912          The age of the object.
913
914       obj.grace
915          Type: DURATION
916
917          Readable from: vcl_hit, vcl_deliver
918
919          The object's grace period in seconds.
920
921       obj.keep
922          Type: DURATION
923
924          Readable from: vcl_hit, vcl_deliver
925
926          The object's keep period in seconds.
927
928       obj.uncacheable
929          Type: BOOL
930
931          Readable from: vcl_deliver
932
933          Whether   the   object   is   uncacheable   (pass,  hit-for-pass  or
934          hit-for-miss).
935
936       obj.storage
937          Type: STEVEDORE
938
939          Readable from: vcl_hit, vcl_deliver
940
941          The storage backend where this object is stored.
942
943       obj.can_esi
944          Type: BOOL
945
946          Readable from: vcl_hit, vcl_deliver
947
948          If the object can be ESI processed, that is if  setting  resp.do_esi
949          or  adding esi to resp.filters in vcl_deliver {} would cause the re‐
950          sponse body to be ESI processed.
951
952   resp
953       This is the response we send to the client, it  is  built  from  either
954       beresp (pass/miss), obj (hits) or created from whole cloth (synth).
955
956       With  the exception of resp.body all resp.* variables available in both
957       vcl_deliver{} and vcl_synth{} as a matter of symmetry.
958
959       resp
960          Type: HTTP
961
962          Readable from: vcl_deliver, vcl_synth
963
964          The entire response HTTP  data  structure,  useful  as  argument  to
965          VMODs.
966
967       resp.body
968          Type: BODY
969
970          Writable from: vcl_synth
971
972          To produce a synthetic response body, for instance for errors.
973
974       resp.proto      VCL <= 4.0
975          Type: STRING
976
977          Readable from: vcl_deliver, vcl_synth
978
979          Writable from: vcl_deliver, vcl_synth
980
981          The HTTP protocol version to use for the response.
982
983       resp.proto      VCL >= 4.1
984          Type: STRING
985
986          Readable from: vcl_deliver, vcl_synth
987
988          The HTTP protocol version to use for the response.
989
990       resp.status
991          Type: INT
992
993          Readable from: vcl_deliver, vcl_synth
994
995          Writable from: vcl_deliver, vcl_synth
996
997          The HTTP status code that will be returned.
998
999          More information in the HTTP response status section.
1000
1001          resp.status  200  will get changed into 304 by core code after a re‐
1002          turn(deliver) from vcl_deliver for conditional  requests  to  cached
1003          content if validation succeeds.
1004
1005          For the validation, first req.http.If-None-Match is compared against
1006          resp.http.Etag. If they compare equal according  to  the  rules  for
1007          weak validation (see RFC7232), a 304 is sent.
1008
1009          Secondly,    req.http.If-Modified-Since    is    compared    against
1010          resp.http.Last-Modified or, if it is unset,  against  the  point  in
1011          time  when  the  object  was last modified based on the Date and Age
1012          headers received with the backend response which created the object.
1013          If  the object has not been modified based on that comparison, a 304
1014          is sent.
1015
1016       resp.reason
1017          Type: STRING
1018
1019          Readable from: vcl_deliver, vcl_synth
1020
1021          Writable from: vcl_deliver, vcl_synth
1022
1023          The HTTP status message that will be returned.
1024
1025       resp.http.*
1026          Type: HEADER
1027
1028          Readable from: vcl_deliver, vcl_synth
1029
1030          Writable from: vcl_deliver, vcl_synth
1031
1032          Unsetable from: vcl_deliver, vcl_synth
1033
1034          The HTTP headers that will be returned.
1035
1036          See req.http.* for general notes.
1037
1038       resp.do_esi     VCL >= 4.1
1039          Type: BOOL
1040
1041          Readable from: vcl_deliver, vcl_synth
1042
1043          Writable from: vcl_deliver, vcl_synth
1044
1045          Default: obj.can_esi
1046
1047          This can be used to selectively disable ESI processing, even  though
1048          ESI  parsing  happened  during  fetch.   This is useful when Varnish
1049          caches peer with each other.
1050
1051          It is a VCL error to use resp.do_esi after setting resp.filters.
1052
1053       resp.is_streaming
1054          Type: BOOL
1055
1056          Readable from: vcl_deliver, vcl_synth
1057
1058          Returns true when the response will be streamed while being  fetched
1059          from the backend.
1060
1061       resp.filters
1062          Type: STRING
1063
1064          Readable from: vcl_deliver, vcl_synth
1065
1066          Writable from: vcl_deliver, vcl_synth
1067
1068          List of VDP filters the resp.body will be pushed through.
1069
1070          Before  resp.filters is set, the value read will be the default fil‐
1071          ter list as determined by varnish based on resp.do_esi  and  request
1072          headers.
1073
1074          After resp.filters is set, changing any of the conditions which oth‐
1075          erwise determine the filter selection will have  no  effiect.  Using
1076          resp.do_esi is an error once resp.filters is set.
1077
1078   Special variables
1079       now
1080          Type: TIME
1081
1082          Readable from: all
1083
1084          The current time, in seconds since the UNIX epoch.
1085
1086          When converted to STRING in expressions it returns a formatted time‐
1087          stamp like Tue, 20 Feb 2018 09:30:31 GMT
1088
1089   sess
1090       A session corresponds to the "conversation" that  Varnish  has  with  a
1091       single  client  connection,  over  which  one  or more request/response
1092       transactions may take place. It may comprise the traffic over an HTTP/1
1093       keep-alive  connection,  or the multiplexed traffic over an HTTP/2 con‐
1094       nection.
1095
1096       sess.xid        VCL >= 4.1
1097          Type: STRING
1098
1099          Readable from: client, backend
1100
1101          Unique ID of this session.
1102
1103       sess.timeout_idle
1104          Type: DURATION
1105
1106          Readable from: client
1107
1108          Writable from: client
1109
1110          Idle timeout for this session, defaults to the timeout_idle  parame‐
1111          ter, see varnishd(1)
1112
1113       sess.timeout_linger
1114          Type: DURATION
1115
1116          Readable from: client
1117
1118          Writable from: client
1119
1120          Linger  timeout for this session, defaults to the timeout_linger pa‐
1121          rameter, see varnishd(1)
1122
1123       sess.send_timeout
1124          Type: DURATION
1125
1126          Readable from: client
1127
1128          Writable from: client
1129
1130          Total  timeout  for  ordinary  HTTP1  responses,  defaults  to   the
1131          send_timeout parameter, see varnishd(1)
1132
1133       sess.idle_send_timeout
1134          Type: DURATION
1135
1136          Readable from: client
1137
1138          Writable from: client
1139
1140          Send  timeout  for  individual pieces of data on client connections,
1141          defaults to the idle_send_timeout parameter, see varnishd(1)
1142
1143   storage
1144       storage.<name>.free_space
1145          Type: BYTES
1146
1147          Readable from: client, backend
1148
1149          Free space available in the named stevedore. Only available for  the
1150          malloc stevedore.
1151
1152       storage.<name>.used_space
1153          Type: BYTES
1154
1155          Readable from: client, backend
1156
1157          Used  space  in  the  named stevedore. Only available for the malloc
1158          stevedore.
1159
1160       storage.<name>.happy
1161          Type: BOOL
1162
1163          Readable from: client, backend
1164
1165          Health status for the named stevedore. Not available in any  of  the
1166          current stevedores.
1167
1168   HTTP response status
1169       A HTTP status code has 3 digits XYZ where X must be between 1 and 5 in‐
1170       cluded.  Since it is not uncommon to see HTTP clients or servers  rely‐
1171       ing on non-standard or even invalid status codes, Varnish can work with
1172       any status between 100 and 999.
1173
1174       Within VCL code it is even possible to use status  codes  in  the  form
1175       VWXYZ  as  long  as the overall value is lower than 65536, but only the
1176       XYZ part will be sent to the client, by which time the X must also have
1177       become non-zero.
1178
1179       The  VWXYZ form of status codes can be communicate extra information in
1180       resp.status and  beresp.status  to  return(synth(...))  and  return(er‐
1181       ror(...)), to indicate which synthetic content to produce:
1182
1183          sub vcl_recv {
1184              if ([...]) {
1185                  return synth(12404);
1186              }
1187          }
1188
1189          sub vcl_synth {
1190              if (resp.status == 12404) {
1191                  [...]       // this specific 404
1192              } else if (resp.status % 1000 == 404) {
1193                  [...]       // all other 404's
1194              }
1195          }
1196
1197       The  obj.status  variable will inherit the VWXYZ form, but in a ban ex‐
1198       presion only the XYZ part will be available. The VWXYZ form is strictly
1199       limited to VCL execution.
1200
1201       Assigning  an  HTTP  standardized  code to resp.status or beresp.status
1202       will also set resp.reason or beresp.reason  to the corresponding status
1203       message.
1204

SEE ALSO

1206varnishd(1)
1207
1208vcl(7)
1209

HISTORY

1211       VCL was developed by Poul-Henning Kamp in cooperation with Verdens Gang
1212       AS, Redpill Linpro and Varnish Software.  This manual page  is  written
1213       by  Per  Buer,  Poul-Henning Kamp, Martin Blix Grydeland, Kristian Lyn‐
1214       gstøl, Lasse Karstensen and others.
1215
1217       This document is licensed under the same license as Varnish itself. See
1218       LICENSE for details.
1219
1220       • Copyright (c) 2006 Verdens Gang AS
1221
1222       • Copyright (c) 2006-2021 Varnish Software AS
1223
1224
1225
1226
1227                                                              VCL-VARIABLES(7)
Impressum