CloudPanel Varnish cache showing old pages or breaking logins: how to fix
Varnish makes CloudPanel sites very fast by keeping a ready-made copy of each page in memory. The downside: when it caches the wrong thing, you see old content, or logged-in pages (account, cart, checkout) behave strangely. This guide shows how to check what Varnish is doing and how to fix the usual problems. For the basics, see CloudPanel cron jobs, logs and Varnish cache.
Step 1: Is Varnish serving this page?
Look at the response headers:
Problem 1: changes don't show up
You edited a page, but visitors still see the old version.
Problem 2: logins, carts or forms break
Symptoms: you log in and get logged out, a customer sees someone else's cart, a form says "expired" or "invalid token". This means a personal page was cached and served to the wrong person. Never let personal pages into the cache.
In the site's Varnish Cache > Settings, add the paths that must never be cached to Excludes. Examples for common apps:
After adding excludes, purge the cache, because pages already cached stay there until purged.
Pages with special query parameters can be excluded through Excluded Params too (for example a parameter your app adds for logged-in previews).
Problem 3: nothing gets cached at all
Usually the app sends cookies or headers on every page, which tells Varnish not to cache. Check the headers from Step 1. Common reasons:
Problem 4: site broken after turning Varnish on
Turn Varnish off for the site first to confirm it's the cause. If the site works without it, turn it on again and add excludes for the broken parts step by step. If you see 502/503 errors instead, see Fix 502 Bad Gateway in CloudPanel.
Is Varnish worth it for my site?
Varnish helps most on sites with many anonymous visitors and pages that rarely change: blogs, magazines, brochure sites. For a busy shop or members site where most visitors are logged in, its benefit is smaller and the excludes list gets long.
Sources: CloudPanel: Varnish Cache settings · Varnish documentation
More CloudPanel troubleshooting
Applies to CloudPanel v2 on Ubuntu and Debian, October 2026. Replace with your domain.
Varnish makes CloudPanel sites very fast by keeping a ready-made copy of each page in memory. The downside: when it caches the wrong thing, you see old content, or logged-in pages (account, cart, checkout) behave strangely. This guide shows how to check what Varnish is doing and how to fix the usual problems. For the basics, see CloudPanel cron jobs, logs and Varnish cache.
Step 1: Is Varnish serving this page?
Look at the response headers:
Code:
curl -sI https://example.com/ | grep -iE 'x-cache|age|cache-control|via|set-cookie'- Age greater than 0, or a cache "HIT" header: the page came from the cache.
- Age 0 or a "MISS" every time: not cached (expected for excluded pages).
- Set-Cookie on normal pages: the app sets cookies everywhere, which affects caching. More on that below.
Problem 1: changes don't show up
You edited a page, but visitors still see the old version.
- Purge the cache: open the site in CloudPanel, go to Varnish Cache and use Purge Entire Cache. You can also purge a single URL or tags. From SSH, as the site user: (orCode:
clpctl varnish-cache:purge --purge=allfor one URL).Code:--purge='https://example.com/page/'
- WordPress: install CloudPanel's Varnish plugin (linked from the site's Varnish Cache section) so pages are purged automatically when you save posts.
- Still old? Something else caches too: a WordPress cache plugin, Cloudflare, or your browser. Purge each one, then test in a private window.
- Lower the cache lifetime in the Varnish settings if content changes often.
Problem 2: logins, carts or forms break
Symptoms: you log in and get logged out, a customer sees someone else's cart, a form says "expired" or "invalid token". This means a personal page was cached and served to the wrong person. Never let personal pages into the cache.
In the site's Varnish Cache > Settings, add the paths that must never be cached to Excludes. Examples for common apps:
Code:
^/wp-admin/
wp-login.php
^/my-account/
^/cart/
^/checkout/Pages with special query parameters can be excluded through Excluded Params too (for example a parameter your app adds for logged-in previews).
Problem 3: nothing gets cached at all
Usually the app sends cookies or
Code:
Cache-Control: no-cache / private- A plugin starts a PHP session on every page (look for a cookie).Code:
PHPSESSID
- A security or analytics plugin sets cookies for every visitor.
- You're testing while logged in. Test in a private window.
Problem 4: site broken after turning Varnish on
Turn Varnish off for the site first to confirm it's the cause. If the site works without it, turn it on again and add excludes for the broken parts step by step. If you see 502/503 errors instead, see Fix 502 Bad Gateway in CloudPanel.
Is Varnish worth it for my site?
Varnish helps most on sites with many anonymous visitors and pages that rarely change: blogs, magazines, brochure sites. For a busy shop or members site where most visitors are logged in, its benefit is smaller and the excludes list gets long.
Sources: CloudPanel: Varnish Cache settings · Varnish documentation
More CloudPanel troubleshooting
- Installation failed: common install errors
- Can't log in: port 8443, password and 2FA
- Site shows 403 Forbidden or 404
- Too many redirects or mixed content after SSL
- PHP extension missing / enable ionCube
- WordPress asks for FTP or can't update plugins
- Restore a site from a backup
- SSH or SFTP login fails
- Node.js app shows 502 or keeps restarting
- Site hacked: find malware and clean up
- clpctl errors: not found, wrong user, quoting
Applies to CloudPanel v2 on Ubuntu and Debian, October 2026. Replace
Code:
example.com
