🧩 What is Varnish?
Varnish is a tool that helps your website load faster and handle more visitors. It does this by caching (storing) public pages so they don't have to be rebuilt by Drupal every time someone visits.
✅ Faster, more reliable browsing.
✅ Great for high-traffic events.
💡 Key Benefits
Fast performance: Pages load almost instantly.
Reliability: Cached pages are available during maintenance.
Lower server usage: Reduces backend strain for each visitor.
👥 Who Is This For?
This guide is designed for:
Site owners and admins who want faster performance.
Content editors who want to know how their updates appear.
Business users interested in reliability and uptime.
🔐 Access and Skills Needed
Access required:
Logged-out (anonymous) access to your website.
Incognito/private browsing to test.
Skills required:
✅ Basic browser skills
✅ Familiarity with Drupal editing
✅ Optional: Inspect → Network tab
❌ No server access or command line needed
❌ No need to understand caching internals
⚙️ How It Works
A visitor loads a public page.
If Varnish has it stored → it's shown immediately.
If not → Drupal builds the page, and Varnish saves it for the next visitor.
When content is updated, the cached version is cleared and refreshed.
📊 Before and After Comparison
Without Varnish | With Varnish |
Pages are rebuilt every visit | Pages load from memory |
High traffic slows the site | Site stays responsive |
Maintenance blocks access | Cached pages stay visible |
Server under constant load | Server focuses on new data |
🧪 How to Check If Varnish Is Working
Method 1: Speed Test
Open an Incognito window.
Visit a public page (e.g., Homepage).
Refresh 2–3 times.
If it's faster on repeat loads → caching is working.
Method 2: Check Headers
You can use your browser's built-in tools to confirm whether a page is being served by Varnish.
Steps:
Open a private/incognito window in your browser.
Go to your website’s homepage (or any public page).
Right-click anywhere on the page and choose “Inspect” or “Inspect Element”.
Click the Network tab at the top of the inspector.
Refresh the page (F5 or ⌘R).
Click on the first item listed—usually the page URL itself.
Under Headers, look for the Response Headers section.
via: 1.1 varnish (Varnish/6.0)
x-cache: HIT
🟢 x-cache: HIT
means the page was served from cache.
🟡 x-cache: MISS
on first load is normal — it gets cached after that.
If you see x-cache: MISS on the first load and then HIT after refreshing, that’s perfectly normal. The first load adds the page to the cache; the second one uses it.
🔄 How Varnish Handles Content Updates
When you update content (e.g. a page or image), Varnish automatically purges the old version.
The next visitor will get the updated version, and that is then cached.
🕒 Cached pages are stored for 1 day.
📌 What’s Cached and What’s Not
Type | Cached? | Notes |
Public pages | ✅ Yes | Fast loading |
Forms / Webforms | ❌ No | Dynamic, user-specific |
Logged-in page views | ❌ No | Always served fresh |
POST requests | ❌ No | Not cacheable |
Session-based content | ❌ No | Privacy protected |
🧱 Special Page Types and Listings
⚠️ Some pages like blogs, news indexes, and anchor pages may not auto-purge when content is added or updated.
📌 If needed, we can manually configure these URLs to purge on updates.
Example: /news
, /events
, /blog
, /resources
🛠 Maintenance Mode Behavior
If your site goes into maintenance mode, cached public pages:
Will continue to show to logged-out visitors
Until the cache expires (1 day), or is manually cleared
This ensures your key pages remain visible even during backend downtime.
✅ Summary
You don’t need to manage Varnish manually.
It works silently in the background, speeding up public browsing.
Logged-in editors always see the freshest version.