Varnish HTTP Purge

Wordpress Plugin
Download latest - 5.1.3

Developers

Ipstenu

Download Stats

Today 995
Yesterday 3,800
Last Week 41,674
All Time 515,142
Banner 772x250

This plugin does not install nor configure a cache proxy. It acts as an interface with such services.

One common method of caching content for websites is via the use of reverse proxy caching. Common examples of this are Varnish and Nginx. These systems allow a website to update content and have the visitor's experience cached without the need for complex plugins storing the files locally and using up a user's disk space.

A reverse proxy cache is installed in front of a server and reviews requests. If the page being requested is already cached, it delivers the cached content. Otherwise it generates the page and the cache on demand.

The Proxy Cache Purge plugin sends a request to delete (aka flush) the cached data of a page or post every time it's modified.

How It Works

When content on a site is updated by WordPress, the plugin reaches out to the proxy cache service with the URL of the page, requesting the cache be deleted.

Not all page are deleted from the cache on every change. For example, when a post, page, or custom post type is edited, or a new comment is added, only the following pages will purge:

  • The front page
  • The post/page edited
  • Any categories, tags, and/or custom taxonomies associated with the page
  • Related feeds
  • Associated JSON API pages

In addition, your entire cache will be deleted on the following actions:

  • Changing themes
  • Pressing the Empty Cache button on the toolbar

Plugins can hook into the purge actions as well, to filter their own events to trigger a purge.

On a multisite network using subfolders, only network admins can purge the main site.

Development Mode

If you're working on a site and need to turn off caching in one of two ways:

  1. Add define( 'VHP_DEVMODE', true ); to your wp-config.php file
  2. Go to Proxy Cache -> Settings and enable debug mode for 24 hours at a time

That will break cache on page loads. It is not recommended for production!

WP CLI

Purge

Purge commands let you empty the cache.

  • wp varnish purge - Flush the cache for your front page
  • wp varnish purge [<url>] - Flush the cache for one URL

You can use the parameter --wildcard to empty everything from that URL down. So if you wanted to empty cache for all themes, you would do this:

  • wp varnish purge https://example.com/wp-content/themes --wildcard

Debug

Debugging can help you figure out why your cache isn't working as well as it could. The default is for your home page, but you can pass any URL on your domain.

  • wp varnish debug [<url>]

Available parameters:

  • [--include-headers] -- Include headers in debug check output
  • [--include-grep] -- Grep active theme and plugin directories for common issues

DevMode

Development mode allows you to disable the cache, temporarily.

  • wp varnish devmode [<activate|deactivate|toggle>] - Change development mode state

Privacy Policy

As of version 5, this plugin no longer uses any remote data.


Releases (34 )

Version Release Date Change Log
5.1.3 2022-06-09
  • June 2022
  • Check if a required option exists before trying to use it
5.1.2 2022-04-12
  • April 2022
  • Fix typo in readme
5.1.1 2022-04-12
  • April 2022
  • Prevent two versions of the plugin from running at once.
5.1.0 2022-02-15
5.0.3 2021-08-30
  • August 2021
  • PHP 8 Compat
5.0.2 2021-04-30
  • April 2021
  • Wrapping a function_exists check which shouldn't be needed, but it fataled for someone and an ounce of prevention yadda yadda.
5.0.1 2021-04-29
5.0 2021-03-30
  • March 2021
  • Now purges draft and pending posts (to account for people who un-publish) - props @jerlarke
  • Localhost the debugger json. They aren't updated that often, and the remote load is unnecessary.
  • More support for Health Check
  • Remove strtotime check on Age header - props Matt Fields
  • Support for multiple IPs (based on P.Brisson's work)

=

4.8.1 2019-05-07
  • May 2019
  • Compat with WP 5.2
  • Correct changes with DB cache flushing (props @mathieuhays)
  • Simplified logic for edge case debugging
4.8 2019-04-04
  • March 2019
  • Improve debugger
  • Clean code per standards
  • Improve callback on WP-CLI

=

4.7.3 2018-12-07
  • December 2018
  • Bugfix for Jetpack (Props @jherve)
4.7.2 2018-10-23
  • October 2018
  • Fix regression with IP function name
  • Restore "Right Now" activity box only for people who use WP.com toolbar
4.7.1 2018-10-11
  • October 2018
  • Documentation: Cleaning up language and spelling
4.7.0 2018-10-08
  • October 2018
  • WP-CLI: documentation
  • Bugfix: Nginx compatibility
  • Bugfix: Only enqueue CSS on front0end if the admin bar is used (props @mathieuhays)
  • Feature: Rebranding
  • Deprecation: "Right Now" button (not needed anymore)

=

4.6.6 2018-09-26
  • September 2018
  • Bugfix to allow Nginx proxy to flush individual pages.
4.6.5 2018-09-07
  • September 2018
  • Bugfix to correct footer output. :facepalm: No broken functionality.
4.6.4 2018-09-06
  • September 2018
  • Remove query variables from URLs to prevent URLs from being flushed more than once per update
  • More selective loading of AMP urls
4.6.3 2018-08-08
  • August 2018
  • Deprecated function support
4.6.2 2018-07-13
  • July 2018
  • Fixing some translation output.
  • Multisite fixes for settings pages.
4.6.1 2018-07-10
4.6.0 2018-07-10
  • July 2018
  • Moved Varnish to it's own menu with a new custom icon (props Olesya)
  • Add option to enable development for 24 hours (for super-admins only)
  • Change debug mode to development mode and greatly improved overall
  • Translation improvements
  • Add new action hook for after a full purge (props @futtta)
  • Change check for age-header to not require a second run (props @danielbachhuber)
  • Confirm plugin and theme blacklist check (props @danielbachhuber)
  • WP-CLI: add debug option to show all header output (props @danielbachhuber)
  • WP-CLI: add debug option to grep content for known issues (props @danielbachhuber)
  • WP-CLI: add new command to change devmode state
4.5.2 2018-06-08
  • June 2018
  • Bug Fix: Prevent error for non-admins
4.5.1 2018-06-04
  • June 2018
  • Due to contention (devs hate it, users like it) the empty cache button colour on the toolbar is removed, and replaced with a carrot icon (I did not make it orange, but I wanted to)
  • Add carrot icon to collapsed (mobile) toolbar
  • Better button hiding
  • Fixed a stupid argument issue with flushing memcached and I should have known better but oh well
  • FAQ update re nginx
4.5.0 2018-05-10
  • May 2018
  • Remote storage of problem plugins/themes
  • Prevent auto-loading of scan for improved disclosure and compliance
  • Changed colour of the purge button for improved visibility
  • Support for nginx proxy headers

=

4.4.0 2018-04-10
  • March 2018
  • Improve translations
  • Massive improvements to the debugging tools
  • Allow for port to be added to host headers (props @davidbarratt)
  • WP-CLI for debugging

=

4.3.1 2017-10-10
  • 10 October 2017
  • Copied a wrong line.
4.3.0 2017-10-10
  • 26 September 2017
  • Add Varnish Flush for "this" page on front end
  • Do not flush non-public taxonomies
4.2.0 2017-08-31
  • More flexible support for custom cat/tag bases
  • Added in support for custom taxonomies
  • New function to generate the URLs, so it can be called by external plugins
  • Move right now box to be called later, preventing double calls
  • Extra check for if it's a URL, because some plugins are weird (props @danielkun)
4.1.1 2017-05-18
  • JSON - fixed overzealous json assumptions from causing errors
  • WP-CLI - fixed prepending of domain on domain when using purge on a domain (props @ocean90)
  • Typos. We hate them.
4.1 2017-04-05
  • JSON / REST API Support
  • Fix for Varnish Status Page on MAMP (props @jeremyclarke)
  • Filter for purge headers (props @ocean90)
  • Disallow people from editing the Varnish IP on Multisite
  • Drop support for pre 4.7 because of JSON / REST API
  • Support flushing cache for private pages

=

4.0.3 2017-03-02
  • Better explanation when Cloudflare gets in the way of DNS
  • Rename flush button for people who don't speak Varnish
4.0.2 2016-11-28
  • Support for WP-CLI commands and PHP > 5.5 (though please upgrade, props @robertpeake)
  • Better information regarding Cloudflare
  • Better failure on domains for scanner
  • Better IP detection
  • Break apart settings for faster saving
4.0.1 2016-11-18
  • Fix typo (on -> one)
  • Correct permissions on Multisite (props @phh - resolves #27 #28)
  • Correct weird merge error (props @phh - resolves #25 #26)
  • Fix formatting in Changelog
4.0 2016-11-16
  • Added Varnish Status Page - Tools -> Varnish Status (includes basic scanning etc)
  • Allow filter for home_url()
  • Update readme with list of filters.
  • Added wp-cli commands to flush specific URLs and wildcards
  • Requires wp-cli 0.25+ to work 3315 for WP 4.6+
  • Update purgePost() to validate page_for_posts (Props JeremyClarke)
  • Add check for AMP (Props JeremyClarke)
  • Purge 'default' AMP URL as well
  • Cleanup on Uninstall

=