The following instructions assume you have the latest version of the Proxy Cache Purge (formerly called “Varnish HTTP Purge”) plugin. If your WP-Admin shows that an update is available for this plugin, please update before proceeding or if you are encountering difficulties with any of the following steps.
DreamPress includes built-in server caching, which speeds up your site significantly. Since caching creates static versions of your site, fewer resources are needed by the server when a customer visits your site. This allows your site to not only load faster, but also helps manage larger amounts of traffic. However, when caching is not working, your site will typically run slower and your resource usage will be higher.
Do I need a caching plugin?
Many WordPress guides, including DreamHost's, recommend caching plugins such as WP Super Cache on WordPress sites. However, since DreamPress comes with built-in caching, a third-party caching plugin such as WP Super Cache is not necessary and might conflict with the DreamPress cache. Instead, DreamHost recommends using its built-in server cache on your DreamPress site. The Proxy Cache Purge plugin is optimized to provide all the tools you need to automatically manage the DreamPress cache and analyze your site's ability to cache. Disabling the plugin doesn't disable the cache, as it's simply a tool to help determine if the cache is working properly or not.
The Proxy Cache Purge plugin comes preinstalled on all new and upgraded DreamPress installations. If you've copied over an existing WordPress site from another host to DreamPress, installing this plugin is highly recommended so that managing your DreamPress cache is automated and does not require your attention under normal circumstances.
Testing your site's cache performance using the Proxy Cache Purge plugin
Due to the thousands of plugins and customizations available for WordPress sites, not all sites automatically work effectively with all caching methods. The Proxy Cache Purge plugin offers an option in your WP-Admin panel for you to check page URLs on your site to make sure they are caching successfully. If a page on your site is not caching, the 'Check Caching' option tells you the items you can check that may resolve this issue.
To access this option:
- Open the WP-Admin page for your DreamPress site (e.g., example.com/wp-admin).
- Hover over 'Proxy Cache' and select the 'Check Caching' option.
- The 'Check Caching Status' page opens where you can check a URL on your site:
- Enter a URL in the 'Check A URL On Your Site' field box, and then click the Check URL button.
This feature auto-scans the URL you selected and reports back any issues it finds as well as any known problematic plugins. If the report says Your caching service appears to be running properly, that means caching on the server is working properly. However, if you see Varnish caching service is running but is unable to cache your site, that means there is an issue with the server cache.
Testing your site's cache via SSH
If you aren't able to use the Proxy Cache Purge plugin, you can also use an SSH command to check your site's cache.
[server]$ curl –I example.com
Your terminal will print several lines of information about the domain specified. If you see x-cache: hit and x-cacheable: Yes:Forced, the server proxy cache is working as intended. If the proxy cache is not working, the command will return x-cache: Miss instead.
Troubleshooting DreamPress cache issues
If the Proxy Cache Purge plugin reports that your caching isn't working, there are several things you can test. The most common steps to resolve cache issues are toggling your plugins, switching out your theme, or identifying possible coding issues.
Proxy services, such as Cloudflare, can cause false-positives with the Proxy Cache Purge testing feature. DreamHost recommends temporarily pausing any proxy services if you're troubleshooting issues with your server caching.
Additionally, please note that the steps below require some technical familiarity with your DreamPress site. If you need any assistance with the troubleshooting process, please contact support.
Switching to a default theme
The first and simplest thing to test is your site's theme. Change your site's active theme to a default theme (such as twentytwentyone) and check the site's server caching again. If you do not have any default themes installed, you can simply download and activate them within the wp-admin page.
Disabling your plugins
After you have verified that the site's theme is not responsible for the caching issues, you should test your plugins next. If any plugins known to cause issues with the server cache are installed on your site, you will see them identified in Proxy Plugin Cache's report output. Otherwise, use the steps below to test your site's active plugins.
DreamHost recommends backing up your site's database before making any changes.
Disable all plugins except for Proxy Cache Purge. Then, rerun the plugin's caching test to determine if server caching is working or not.
If disabling plugins results in your site's caching service working again, that means there is a plugin that is the most likely cause of the cache issues. However, if you disabled multiple plugins, you will need to do further testing to determine which plugins may be responsible. Follow the instructions below to test the site's plugins individually.
- Enable your installed plugins one at a time, rerunning the cache test after each. Make sure that you clear your site's cache after each test, to avoid seeing cached results.
- Continue this process until the cache test returns the "unable to cache site" message, identifying the problematic plugin. Leave this plugin disabled.
- Reenable any remaining disabled plugins and run the test again. If the cache test continues to report issues, multiple plugins may be responsible. Continue the troubleshooting process until any plugins that are preventing the site's server cache from functioning are disabled.
If any of the disabled plugins are necessary for your site's intended functionality, you will need to contact their plugin developer to find a workaround or a way to work with the site's cache.
If your site is using any additional caching plugins, be sure to delete the contents of your ./wp-content/cache folder.
Checking your plugins and themes using SSH
If you are comfortable using SSH, there are a pair of commands you can run from your website directory to help narrow down the list of plugins and themes to check.
Run the following command to check your plugins for potentially problematic code:
[server]$ grep -Rilon -P '(?:PHPSESSID|session_start|start_session)' ./wp-content/plugins/
Run this command to check your theme's code:
[server]$ grep -Rilon -P '(?:PHPSESSID|session_start|start_session)' ./wp-content/themes/
There may be multiple false positives, such as the Proxy Cache Purge plugin. Test any other plugins or themes that turn up in the results using the instructions in the previous sections of this article.
Testing your .htaccess
If your server caching is still not working even with your plugins disabled and the theme set to a default theme, your next step is to disable your site's .htaccess file. Using FTP or SSH, rename your .htaccess file to .htaccess.off and create a new .htaccess file with the default WordPress coding.
Some plugins may automatically add problematic lines to your site's .htaccess file. Below are two SSH commands that you can run to check for code that may conflict with the server cache:
[server]$ grep -r no-cache wp-content/* [server]$ grep -r age=0 wp-content/*
Once you've set up the default .htaccess, test your site's cache again. If the default .htaccess coding still doesn't fix your caching error, it's most likely the custom code being used on your domain. Please be sure to check with your developer regarding any custom content.
Temporarily bypassing the DreamPress cache
The Proxy Cache Purge plugin includes a 'Development Mode' feature, which allows you to temporarily bypass caching for all visitors. This prevents visitors from seeing any old cached content on your WordPress site. You might find this useful if your site is still under development or if you are making major changes to the design. In addition, if you are having issues with a theme or plugin, your developer may ask you to try disabling the cache for further testing.
When Development Mode is enabled, your site runs slower so please use with caution.
You can enable this feature for 24 hours, after which it automatically disables itself. You can also manually turn off Development Mode before the 24 hours have elapsed when you complete your changes or testing. Disabling Development Mode then allows DreamPress to resume caching and thus improves the page loading time for your visitors.
To disable caching (activate Development Mode):
- Open the WP-Admin dashboard page for your DreamPress site (e.g., example.com/wp-admin).
- Select 'Proxy Cache > Settings' in the left pane of your WP-Admin dashboard:
- The Proxy Cache Purge Settings page opens:
- Scroll down to the Development Mode Settings section and check the Activate Development Mode checkbox.
- Click the Save Settings button.
- The following confirmation message appears on the settings page:
- You can also confirm if the built-in server cache is inactive by viewing the Cache status located in the WP-Admin toolbar at the top:
Development Mode remains active for 24 hours, after which it disables and caching resumes normally. You can also manually disable Development Mode on this same page by returning to the 'Settings' page and unchecking the Development Mode checkbox and then saving it.
When would I need to purge my cache?
When you make changes to your site such as customizing or creating new content, the new changes may not show live yet because the old version of your site is cached. Purging your cache can help to push your changes live so visitors see the most recent version of your site.
Manually purging the cache via the plugin
The Proxy Cache Purge plugin includes a 'Purge Cache' button located in the WP-Admin toolbar at the top:
Clicking 'Purge Cache (All Pages)' purges the entire cache. USE SPARINGLY—the whole point of caching is to cache.
A better alternative is to selectively purge the cache of a specific item that you changed, when the changes aren’t showing up. You can purge a post or page from cache using the plugin’s Purge Cache button when you view the live page.
To purge cache for an individual post or page:
- Make sure you are logged into WP-Admin for your site.
- Load the URL of the page or post you want to purge from cache. You can also click the
- In the WP-Admin toolbar at the top of the page, hover over the Cache button and select Purge Cache (This Page) from the dropdown menu options.
The page reloads and the post or page is purged from cache.
If you need to selectively purge specific files such as CSS you manually changed and uploaded via SFTP/SSH, you'll need to do it via SSH for now.
Manually purging the cache via SSH
The following is an example command of how to purge a single CSS file:
[server]$ wp varnish purge https://example.com/wp-content/themes/mytheme/style.css
If you are making changes to your theme files, or updating various themes, the following is a simple way to clear all theme files from your cache:
[server]$ wp varnish purge https://example.com/wp-content/themes/ --wildcard