The Varnish Book for Varnish 4.0¶
Table of Contents:
- Introduction
- Design Principles
- Getting Started
- Varnish Distribution
- Exercise: Install Varnish
- Exercise: Configure Varnish
- The front-end
varnishadm
of the Varnish Command Line Interface (CLI) - More About Varnish Configuration
- Command Line Configuration
- Defining a Backend in VCL
- Exercise: Use the administration interface to learn, review and set Varnish parameters
- Exercise: Fetch Data Through Varnish
- Examining Varnish Server’s Output
- Tuning
- HTTP
- VCL Basics
- Varnish Finite State Machine
- Detailed Varnish Request Flow for the Client Worker Thread
- The VCL Finite State Machine
- VCL Syntax
- VCL Built-in Functions and Keywords
- Legal Return Actions
- Variables in VCL subroutines
- Built-in
vcl_recv
- Detailed Varnish Request Flow for the Backend Worker Thread
- VCL –
vcl_backend_response
- Waiting State
- Summary of VCL Basics
- VCL Subroutines
- Cache Invalidation
- Saving a Request
- Content Composition
- Varnish Plus Software Components
- Appendix A: Resources
- Appendix B: Varnish Programs
varnishtop
varnishncsa
varnishhist
- Exercise: Try
varnishstat
,varnishlog
andvarnishhist
varnishtest
- The Varnish Test Case (VTC) Language
- Synchronization in Varnish Tests
- Running Your Varnish Test Cases
- Exercise: Test Apache as Backend with
varnishtest
- Setting Parameters in
varnishtest
- Fetch Data with
varnishtest
- Understanding
Expires
invarnishtest
- Example of Transactions in
varnishtest
logexpect
- Exercise: Assert Counters in
varnishtest
- Understanding
Vary
invarnishtest
- Understanding
Last-Modified
andIf-Modified-Since
invarnishtest
- Understanding
Cache-Control
invarnishtest
- VCL in
varnishtest
PURGE
invarnishtest
- Cache Invalidation in
varnishtest
- Understanding Grace using
varnishtest
- Exercise: Handle Cookies with
Vary
andhash_data()
invarnishtest
- Understanding ESI in
varnishtest
- Appendix C: Extra Material
- Appendix D: VMOD Development
- Appendix E: Varnish Three Letter Acronyms
- Appendix F: Apache as Backend
- Appendix G: Solutions
- Solution: Install Varnish
- Solution: Test Apache as Backend with
varnishtest
- Solution: Assert Counters in
varnishtest
- Solution: Tune
first_byte_timeout
and test it against mock-up server - Solution: Configure
vcl_recv
to avoid caching all requests to the URL/admin
- Solution: Configure Threading with
varnishadm
andvarnishstat
- Solution: Configure Threading with
varnishtest
- Solution: Rewrite URL and Host Header Fields
- Solution: Avoid caching a page
- Solution: Either use
s-maxage
or set TTL by file type - Solution: Modify the HTTP response header fields
- Solution: Change the error message
- Solution:
PURGE
an article from the backend - Solution: Write a VCL program using purge and ban
- Solution: Handle Cookies with
Vary
invarnishtest
- Solution: Handle Cookies with
hash_data()
invarnishtest
- Solution: Write a VCL that masquerades XHR calls
Version and copyright¶
Authors: | Francisco Velázquez (Varnish Software), Kristian Lyngstøl, Tollef Fog Heen, Jérôme Renard |
---|---|
Copyright: | Varnish Software AS 2010-2015, Redpill Linpro AS 2008-2009 |
Versions: | Documentation version 4.x-72-g5b9b11e / Tested for Varnish plus-4.1.8r1 |
Date: | 2018-01-30 |
License: | The material is available under a CC-BY-NC-SA license. See http://creativecommons.org/licenses/by-nc-sa/3.0/ for the full license. For questions regarding what we mean by non-commercial, please contact training@varnish-software.com. |
Contact: | For any questions regarding this training material, please contact training@varnish-software.com. |
Web: | https://info.varnish-software.com/the-varnish-book |
Source: | http://github.com/varnish/Varnish-Book/ |
About the material¶
This book is part of Varnish Software’s (http://www.varnish-software.com) official training material for Varnish 4. The material is primarily written to be used in a classroom context.
The training material evolves constantly. Some chapters are more developed than others. The trainer compensates those less developed chapters with live demonstrations or more in-depth discussion.
All the VCL code examples are verified for syntax-correctness frequently (semi-automatically). This does not, however, guarantee that they do what they are supposed to do, only that it is correct VCL syntax.