MSCache Varnish Purge
MSCache Varnish Purge helps WordPress administrators purge the Varnish cache for sites running behind a Varnish HTTP reverse proxy. It is developed by Managed Server S.r.l. and provides settings for configuring the Varnish connection, automatic cache invalidation when content changes, and manual purge tools available from the WordPress admin area. This plugin is useful when your WordPress site sits behind Varnish and you need cached pages to be invalidated after content is published or updated, or on demand. It requires a reachable Varnish instance whose VCL is configured to accept PURGE requests from the WordPress server (see the FAQ for a reference VCL). The settings page is available at Settings → MSCache Varnish Purge. On WordPress Multisite, shared connection settings are configured at Network Admin → Settings → MSCache Network, while each site keeps its own purge options. Key Features Asynchronous raw socket PURGE — sends PURGE requests via a direct TCP socket (fsockopen) without waiting for the Varnish response, so the purge request does not block the WordPress request. Automatic purge on content changes — when a post, page, or custom post type is published, updated, trashed, or deleted, the plugin automatically purges the affected URLs including the post itself, home page, categories, tags, author archives, and date archives. Full cache purge — supports multiple methods for purging the entire cache: PURGE wildcard, PURGE custom path, or BAN with configurable header. Additional URLs — define a list of extra paths to purge alongside content changes or on demand. Exclusion patterns — define glob or regex patterns for URLs that should be excluded from caching. Matching requests receive the ms-cache: excluded HTTP header, which can be used by Varnish to skip caching. Admin bar integration — quick-access purge buttons in the WordPress admin bar: Purge All, Purge Home, Purge Current Page. Bulk and row actions — purge cache for selected posts/pages directly from the list table. Debug logging — optional logging of all purge operations to a protected log directory. PHP 7 and PHP 8 compatible — works on PHP 7.0 through PHP 8.x without deprecation warnings. How It Works The plugin opens a raw TCP socket to your Varnish server and sends an HTTP PURGE request with the appropriate Host header. The socket is closed immediately after writing the request — the plugin does not wait for Varnish to respond. This “fire and forget” approach is designed to avoid blocking the WordPress request while the purge is processed. External Services This plugin optionally connects to the following external services when configured by the administrator: Cloudflare API — When the Cloudflare integration is enabled, the plugin sends cache purge requests to the Cloudflare API v4 (https://api.cloudflare.com/client/v4/) to synchronize Varnish cache invalidation with Cloudflare CDN edge cache. This requires a Cloudflare account, a Zone ID, and an API Token with “Zone.Cache Purge” permission. No personal data or visitor information is transmitted — only URL paths and authentication credentials are sent. Cloudflare Terms of Service Cloudflare Privacy Policy Varnish Cache — The plugin opens raw TCP socket connections to a Varnish server at a user-configured IP address and port (default: 127.0.0.1:80). This is typically a localhost connection to infrastructure managed by the site administrator. No external third-party service is contacted for this functionality. Data Handling & Logging When debug mode is enabled by the administrator, the plugin logs technical data (URL paths, timestamps, socket connection status, purge results) to files in wp-content/uploads/mscache-logs/. Log files are protected with .htaccess rules, obfuscated filenames, and an index.php guard. No personally identifiable information (PII) or visitor data is collected, stored, or transmitted. Purge statistics (success/failure counts, recent activity) are stored in the WordPress options table and are visible only to administrators. Configuration General Settings Enable Plugin — master switch for all purge functionality. Varnish IP — the IP address of your Varnish server (default: 127.0.0.1). Varnish Port — the port Varnish listens on (default: 80). Custom Host Header — override the Host header sent with purge requests. Leave empty to use your WordPress site URL. Socket Timeout — connection timeout in seconds (default: 5). Automatic Purge Choose which content changes trigger automatic cache purge: Posts, Pages, Custom Post Types Home page Category, tag, author, and date archives Full Cache Purge Three methods are available: PURGE /.* — sends a PURGE request with a wildcard path. Requires Varnish VCL to handle regex/wildcard PURGE. PURGE custom path — sends PURGE to a specific path (e.g., /purge-all). Useful when your VCL maps a special path to a full ban. BAN with custom header — sends a BAN request with a configurable header name and value. The most flexible option but requires matching VCL configuration. Important: The actual behavior of a full purge depends entirely on your Varnish VCL configuration. The plugin only sends the request — it is your VCL that decides what gets purged. Additional URLs Enter one URL per line (absolute or relative paths). These URLs can be purged: Automatically alongside post/page saves (if the option is enabled) Manually via the “Purge Additional URLs” button Exclusions Define patterns (one per line) for URLs that should be excluded from caching. Two matching modes: Glob (default) — supports * (any characters) and ? (single character). Example: /wp-admin/*, /cart*, *.xml Regex (advanced) — full regular expression support. Use with caution. When a frontend request matches an exclusion pattern, the plugin sends the HTTP header ms-cache: excluded. Your Varnish VCL can check for this header and bypass caching accordingly. Lines starting with # are treated as comments and ignored. Matching is performed on the request path only, ignoring the query string. Disclaimer This plugin is provided “as is” under the terms of the GNU General Public License v2 or later. MANAGED SERVER S.R.L. does not warrant that the plugin will function correctly on hosting environments, servers, or Varnish configurations not directly managed by the company. The plugin has been tested and validated exclusively on the Managed Server hosting infrastructure. Use on third-party environments is at the user’s sole risk and responsibility. In no event shall MANAGED SERVER S.R.L. be liable for any direct, indirect, incidental, or consequential damages arising from the use of this plugin outside of the Managed Server infrastructure.
Top keywords
- purge38×3.70%
- varnish22×2.14%
- cache12×1.17%
- request10×0.97%
- wordpress10×0.97%
- header9×0.88%
- server9×0.88%
- cloudflare8×0.78%
- sends8×0.78%
- vcl8×0.78%
- managed7×0.68%
- socket7×0.68%
SpinupWP
This plugin ensures that the SpinupWP page cache is cleared when your site’s content changes. Not using SpinupWP yet? Sign up here. SpinupWP is a modern server control panel that’s here to help you implement best practices for every server you spin up. Designed for WordPress. This companion plugin should be installed on sites created using SpinupWP to allow the page cache to be cleared when your site’s content changes. Not using SpinupWP yet? Sign up here. Any Provider We support DigitalOcean, Linode, AWS, and any other provider. If your server has an IP address, you can connect SpinupWP. It does need to be a fresh install of Ubuntu though. Latest & Greatest Software SpinupWP will install the latest stable versions of Nginx, PHP, MySQL/MariaDB, and Redis from the standard apt-get repos. No who-knows-what-they-did custom builds of packages. Disconnect from SpinupWP in the future and you can still keep your packages up-to-date with apt-get upgrade. Automatic Security Updates SpinupWP will configure your server to install security updates as soon as they are available to reduce the likelihood of a software vulnerability putting your server at risk. Free SSL/TLS Certificates Serving your site over HTTPS is essential these days, not only for security, but to take advantage of the performance improvements of HTTP/2 as well. When you add a site to SpinupWP, a free Let’s Encrypt SSL/TLS certificate will be acquired, installed, and configured for your site. And SpinupWP will handle certificate renewals as well, so you hardly need to think about certificates. Cache All the Things One of the keys to a great performing WordPress site is caching. All sites are set up with Redis object caching to greatly reduce database requests. And with the check of a box you can enable full-page caching to serve pages lightning fast without even hitting PHP. Git Push-to-Deploy Developers! Developers! Developers! Add a git repository to your SpinupWP site and simply push to master to deploy your code. GitHub, Bitbucket, or a custom git repo will work. You can also configure a build script to run some tasks on the server after deployment is complete. Error Logs WordPress doesn’t enable error logging by default. Probably because the log is saved to a publicly accessible directory and can quickly balloon to take up a lot of hard drive space. SpinupWP enables error logs by default but stores them in a safe place and makes sure they’re rotated regularly like other server logs. Security Security Security Each server provisioned by SpinupWP is security-hardened from the word go. SSH login is disabled for the root user (you login with your user and use sudo instead). The firewall only allows connections to Nginx and SSH and failed attempts are monitored and blocked when the reach a threshold. Nginx is configured to defend against XSS, clickjacking, MIME sniffing, and other attacks. Software security updates are installed automatically. Scheduled Posts Published on Schedule For every site you add via SpinupWP, a server-side cron job will be configured to make sure that your WordPress site’s cron is executed every minute, as it should be. WP-CLI Preloaded If you love WP-CLI (we do! ❤) you’ll be very pleased to find it available on the command line the first time you login to your server. Security Isolation for Sites For each site that you add to your server via SpinupWP, a new system user is created for that site. All site files are owned by the site user and a PHP-FPM pool is configured to run as that user as well. Each site only has access to its files and so if only one site has a security vulnerability and gets infected with malware for example, only the files for that one site can be infected. SFTP Access for Your Clients If you’re hosting a site for someone else, you can easily give them SFTP/SSH access to just that site. And because of the security isolation between sites, they will only have access to files for that site. Professional Guidance & Best Practices SpinupWP will actively point you in the right direction and offer suggestions for maintaining your server. And because it provides detailed feedback about the operations it runs on your server, you can learn what is happening with your server. New release of Ubuntu just came out, should I upgrade? We’ll add a notice to the app about that, why we don’t recommend upgrading your existing servers, and how you can spin up a new server with the new release of Ubuntu and migrate your sites to that server instead. Should I install Varnish to improve page caching performance? We’ve benchmarked Varnish and Nginx FastCGI Cache performed better. Varnish would add complexity too, so one less moving part is another reason. Much of the time SpinupWP will suggest things that you may not have even thought of. Email deliverability for example. SpinupWP will strongly encourage you to configure an email sending plugin for the best email deliverability. SpinupWP’s guidance is especially helpful for those new to managing a server, but can also help those who’ve been at it a while, providing transparency to our decisions. Scheduled Backups of Site Files & Database All server providers (DigitalOcean, Linode, etc) offer automated backups of your entire server for a fee. These services are great and we highly recommend having backups of your whole server. But what happens if some media or data was deleted by accident from your WordPress site? You’re not going to restore your entire server just to get that data back. That’s where site backups come in. Site backups are full backups of your site files (media, themes, and plugins) and database. They allow you to easily restore a single site or just some files or data from a single site. With SpinupWP’s site backups, you choose your preferred provider to stash your backups whether that’s Amazon S3, DigitalOcean Spaces, or Google Cloud Storage. You plug in your account details and SpinupWP will send your site backups there in an easy-to-see format. Teamwork Makes the Dream Work Create a new team account, invite a member of your team, and allow them to spin up their own servers. Or just only allow them to add sites, the permissions you give them is up to you. Features Page cache purging Persistent object caching Ensures debug.log files aren’t saved in a publicly-accessible location