Contents Menu Expand Light mode Dark mode Auto light/dark mode
Vinyl Cache version 9.0.0 documentation
Logo
Vinyl Cache version 9.0.0 documentation
  • Varnish Installation
    • Prerequisites
    • Installing Vinyl Cache
      • Installing on Debian/Ubuntu
      • Installing on FreeBSD
      • Installing on OpenBSD
      • Installing on RedHat or CentOS
    • Compiling Vinyl Cache from source
      • Compiling Varnish from source
    • Other pre-built Varnish packages
    • Getting help
    • Reporting bugs
    • Platform specific notes
  • The Varnish Tutorial
    • Varnish: The beef in the sandwich
    • How Varnish works
    • Caching with Varnish
    • Content Composition with Varnish
    • Content Policy with Varnish
    • Varnish is general purpose
    • Starting Vinyl Cache
    • Put Varnish on port 80
    • Restarting Varnish again
    • Backend servers
    • Peculiarities
    • Now what?
  • The Varnish Users Guide
    • The Big Varnish Picture
    • Starting and running Varnish
      • Security first
      • Required command line arguments
      • CLI - bossing Varnish around
      • Storage backends
      • Transient Storage
      • Parameters
      • Sizing your cache
    • VCL - Varnish Configuration Language
      • VCL Syntax
      • Built-in VCL
      • Request and response VCL objects
      • Backend servers
      • The “none” backend
      • Multiple backends
      • Backends and virtual hosts in Varnish
      • Connecting Through a Proxy
      • Directors
      • Health checks
      • Layering
      • Director Resolution
      • Connection Pooling
      • Hashing
      • Grace mode and keep
      • Separate VCL files
      • Using inline C to extend Varnish
      • VCL Examples
        • Manipulating request headers in VCL
        • Altering the backend response
        • ACLs
        • Adding WebSockets support
      • Device detection
    • Reporting and statistics
      • Logging in Varnish
      • Statistics
    • Varnish and Website Performance
      • Achieving a high hitrate
      • The role of HTTP Headers
      • HTTP Vary
      • Cache misses
      • Uncacheable content
      • Purging and banning
      • Compression
    • Content composition with Edge Side Includes
    • Troubleshooting Varnish
  • The Varnish Reference Manual
    • VCL - The Varnish Configuration Language
    • VCL Variables
    • VCL Steps
    • VCL backend configuration
    • VCL backend health probe
    • Varnish Processing States
    • VMOD blob - Utilities for the VCL blob type, encoding and decoding
    • VMOD cookie - Varnish Cache Cookie Module
    • VMOD directors - Varnish Cache Directors Module
    • VMOD h2 - Module to control the built-in HTTP2 transport
    • VMOD math - VMOD wrapping math.h
    • VMOD proxy - Varnish Cache Module to extract TLV attributes from PROXYv2
    • VMOD purge - Varnish Cache Purge Module
    • VMOD std - Varnish Cache Standard Module
    • VMOD unix - Utilities for Unix domain sockets
    • VarnishAdm - Control program for Varnish
    • CLI - The commands varnish understands
    • VSL - The log records Varnish generates
    • VSLQ - Filter/Query expressions for VSL
    • VarnishLog - Logging raw VSL
    • VarnishNCSA - Logging in NCSA format
    • VarnishLog-JSON - Structured logging
    • VarnishHist - Realtime response histogram display
    • VarnishTop - Realtime activity display
    • VSC - The statistics Varnish collects
    • VarnishStat - Watching and logging statistics
    • VarnishD - The program which does the actual work
    • VTC - Language for writing test cases
    • VarnishTest - execute test cases
    • VMOD vtc - Utility module for varnishtest
    • Shell tricks
    • VMODS - Extensions to VCL
    • VEXT - Varnish Extensions
    • VSM - Shared memory use
    • VDIR - Backends & Directors
    • VCLI - CLI protocol API
    • VTLA - Varnish Three Letter Acronyms
  • VCL Design Patterns
    • Using extra digits in resp.status
    • Ignoring the Vary header for bots
  • What’s new / Upgrading
    • Changes in Varnish Cache 9.0
    • Upgrading to Varnish Cache 9.0
    • Changes in Varnish-Cache 8.0
    • Upgrading to Varnish-Cache 8.0
    • Changes in Varnish 6.0
    • Upgrading to Varnish 6.0
  • The Varnish Developers Guide
    • Varnish Cache organization and day-to-day operation
    • Bundling VMODs with the Varnish distribution
    • How our website works
    • How to contribute content to varnish-cache.org
    • Who is … ?
  • Poul-Hennings random outbursts
    • On the deck-chairs of HTTP/2
    • How Varnish met CHERI 7/N
    • How Varnish met CHERI 6/N
    • How Varnish met CHERI 5/N
    • How Varnish met CHERI 4/N
    • How Varnish met CHERI 3/N
    • How Varnish met CHERI 2/N
    • How Varnish met CHERI 1/N
    • Getting into the routine
    • The 503’s heard around the world
    • Legacy-.*
    • IP Addresses - A long expected problem
    • Varnish Developer Day 2019Q3
    • QUIC visions of OSI
    • Here we are again - VSV00003 in perspective
    • A patently good idea
    • Do you feel lucky ?
    • API spaces
    • Yah! A security issue - finally!
    • Something (funny) happened on the way to 5.1.0^H1^H2
    • Trial&Error - Prototyping - Continuous Integration
    • Far, far away
    • Going fast slowly
    • The first design of Varnish
    • Varnish - 10 going on 50
    • Brinch-Hansens Arrows
    • SSL revisited
    • A persistent message
    • Raking in the dough on Free and Open Source Software
    • Wanton destruction for the greater good
    • What SPDY did to my summer vacation
    • Why HTTP/2.0 does not seem interesting
    • Varnish Does Not Hash
    • The Tools We Work With
    • Thoughts on the eve of Varnish 3.0
    • Why no SSL ?
    • How GZIP, and GZIP+ESI works in Varnish
    • VCL Expressions
    • IPv6 Suckage
    • What do you mean by ‘backend’ ?
    • Picking platforms
    • Security barriers in Varnish
    • What were they thinking ?
    • Did you call them autocrap tools ?
    • Why Sphinx and reStructuredText ?
    • Notes from the Architect
  • Varnish Glossary
Back to top

VCL Examples#

These are a short collection of examples that showcase some of the capabilities of the VCL language.

  • Manipulating request headers in VCL
  • Altering the backend response
  • ACLs
  • Adding WebSockets support
Next
Manipulating request headers in VCL
Previous
Using inline C to extend Varnish
Copyright © 2016-2026, The Varnish Cache and Vinyl Cache Contributors. Vinyl Cache Logo & Mascot: CC-BY 4.0 Rhubarbe.design
Made with Sphinx and @pradyunsg's Furo