VCLThe main action:
pass：When a request is pass, the request will be forwarded to the back-end server through varnish, which will not be delayed.
Save, subsequent requests are still processed by Varnish. Pass can be placed in vcl_recv and vcl_fetch.
lookup：When a request is lookup in vcl_recv, varnish will extract data from the cache if it is cached.
Without data, it will be set to pass, and lookup can not be set in vcl_fetch.
pipe：pipeSimilar to pass, you have to access the back-end server, but when you enter pipe mode, the connection is not yet.
Before closing, all subsequent requests are sent directly to the back-end server without Varnish processing.
deliver：The requested target is cached and sent to the client.
hit_for_pass：It means that getting data directly from the background will create an object of hit_for_pass, the TTL of the object.
The value will be set to the current value of the beresp.ttl. To control how vcl_deliver handles current requests.
Subsequent requests will be directly vcl_pass, which can be used in vcl_fetch.
fetch：Obtain the request target from the back-end server and transfer the control to vcl_fetch.
hash：Entering the Hash mode
restart：Restart the transaction and return it to vcl_recv if the restart number exceeds max_restarts.
error：Make a mistake
VCLThere are 3 important data structures
Request the target, when varnish receives a request, then the req object is created, and most of the work in the vcl_recv is expanded on req object.
- client.ip：Client IP
- req.request：Request types, such as “GET”, “HEAD”
- req.url：Requested URL
- req.backend：Which backend server is used to provide service for this request?
- req.backend.healthy：Whether the back end server is healthy
- req.http.header：Corresponding HTTP head
- req.grace：Setting the time for the object to be kept
The target returned by the back-end server contains header information returned, and most of the work in vcl_fetch is carried out on beresp object.
- bereq.request( like“GET”, “HEAD”)
- bereq.http.headerHTTP header
- beresp.do_gzip: is it before storageGzip compression
- beresp.do_gunzip: whether to unpack before storage
- beresp.http.header:HTTP header
- beresp.ttl: the time for the object to be preserved
- beresp.grace: objectgrace Post Views: 10