Varnish VCL Generator
Generate a Varnish 4.1 VCL with a health-checked backend, a PURGE ACL, paths that are never cached, tracking parameters stripped, cookie handling and grace mode.
Free · No sign-up · Your inputs stay in your browser
Input
Generate a Varnish VCL
Output
default.vcl
1,802 characters
Cookies are what usually stop Varnish from caching anything: a request with any Cookie header is passed by the built-in VCL, and analytics sets one on every visitor. This keeps only the session cookie, so logged-out traffic is cached and logged-in traffic is not. Test with varnishd -C -f default.vcl, and watch hit rates with varnishstat.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Cookies decide your hit rate
Varnish's built-in logic passes any request with a Cookie header and refuses to cache any response with Set-Cookie. Analytics and consent banners set cookies for every visitor, so without cookie handling nothing is cached. Keeping only the session cookie, as this VCL does, caches logged-out traffic and passes logged-in traffic. The hit rate guide explains the built-in rules.
Grace keeps the site up
With grace, Varnish serves a stale object while it fetches a fresh one in the background, and keeps serving it if the backend is down, within the grace period.