`

variable - varnish

阅读更多

variable

 

some global variable are avaliable in subroutings, in different stage there are different variable avaliable,

 

ref: https://www.varnish-cache.org/docs/3.0/reference/vcl.html#subroutines

 

------

set variable value

 

keyword 'set', is used to set value of variable,

format:

set xxx = yyy;

 

------

unset / remove header

 

keyword 'unset' or 'remove' (the same), are used to remove value of variable,

format:

unset xxx;

remove xxx;

 

------

variable - always avaliable

 

* now

current time in seconds,

 

------

variable - in backend declaration

 

* .host

hostname or ip

* .port

port number or service name

 

------

variable - while processing request

 

* client.ip

* client.identity

Identification of the client, used to load balance in the client director.

* server.hostname

* server.identity

* server.ip

* server.port

* req.request

request type, 

e.g:

"GET" , "POST" , "HEAD"

* req.url

the requested url,

* req.proto

http protocol version used by the client,

* req.backend

the backend used to serve this request

* req.healthy

Whether the backend is healthy or not. Requires an active probe to be set on the backend.

* req.http.header

http headers,

* req.hash_always_miss

Force a cache miss for this request. If set to true Varnish will disregard any existing objects and always (re)fetch from the backend.

* req.hash_ignore_busy

Ignore any busy object during cache lookup, may avoid deadlock,

* req.can_gzip

whether the client support gzip,

* req.restarts

restart counter

* req.esi

boolean, whether enable ESI,

* req.esi_level

* req.grace

* req.xid

unique id for this request,

 

------

variable - while preparing a backend request (cache miss / pass / pipe)

 

* bereq.request

request type,

e.g:

"GET" , "POST" , "HEAD"

* bereq.url

requested url,

* bereq.proto

http protocol version,

* bereq.http.header

http headers,

* bereq.connect_timeout

The time in seconds to wait for a backend connection.

* bereq.first_byte_timeout

The time in seconds to wait for the first byte from the backend. Not available in pipe mode.

* bereq.between_bytes_timeout

The time in seconds to wait between each received byte from the backend. Not available in pipe mode.

 

------

variable - after retrieve from backend & before enter cache (vcl_fetch)

 

* beresp.do_stream

Deliver the object to the client directly without fetching the whole object into varnish. If this request is pass'ed it will not be stored in memory.

* beresp.do_esi

boolean, whether ESI-process the object after fetching it, default to false,

* beresp.do_gzip

boolean, whether do gzip before storing it, default to false,

* beresp.do_gunzip

boolean, whether do unzip before storing it, default to false,

* beresp.proto

http protocol version

* beresp.status

http status code returned by server,

* beresp.response

http status message returned by server,

* beresp.ttl

ttl of the object, writable,

* beresp.grace

set a period to enable grace,

* beresp.saintmode

set a period to enable saint mode,

* beresp.backend.name

* beresp.backend.ip

* beresp.backend.port

* beresp.storage

force varnish to store this object to a particular backend storage,

 

 

------

variable - after enter cache (vcl_hit / vcl_deliver / ..)

 

* obj.proto

* obj.status

http status code

* obj.response

http status message

* obj.ttl

* obj.lastuse

the about time passed since last use of this object, in seconds,

* obj.hits

the about times of this object has been delivered, 0 means cache miss,

* obj.grace

* obj.http.header

 

------

variable - while determining the hash key of an object

 

* req.hash

the hash key of this object, used when reading from and writing to the cache,

 

------

variable - while preparing a response to the client

 

* resp.proto

* resp.status

* resp.response

* resp.http.header

 

------


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics