Caching

By default, the GDPR Consent plugin will attempt to bypass the cache when you decide to disallow plugins or allow scripts to run when a consent is given.

The next section is only for advanced users. Please consider hiring a developer if you’re unfamiliar with caching configuration. Configuring this incorrectly can lead to non-functioning or wrong GDPR compliance.

To disable the cache bypass, toggle the setting “disable cache bypass” to on in the advanced section of the plugin settings.

In order to serve cached content, you’ll need to separate the cache by consents given. How to configure this depends heavily on your website’s infrastructure and plugins used. You can find some examples below on how to achieve this on some hosts, plugins and other 3rd parties. The terminology usually used for this is “Cache Key” or “Cache Group”

For multisite users: Replace the last number in gdprc_consents_1 with your blog id

Checking the results:

To verify the results, you can follow the following procedure.

  1. Clear all cache
  2. Visit the website in incognito mode with your developer network tool open and check for a cache status and cache group header, e.g. X-Cache-status, X-Cache-group. The status header should show “MISS” or similar and, if you have one, note the cache group name.
  3. Reload the page; The header should now show “HIT” or similar.
  4. Accept the consent, and reload the page if it doesn’t automatically. The status header should now show “MISS” or similar, and your cache group header should show a different group name.
  5. Reload the page; The header should now show “HIT” or similar.
  6. Triple-check: Toggle a consent and reload the page. Again, the status header should now show “MISS” or similar, and your cache group header should show a different group name.
  7. You’re good to go!

3rd part examples

Kinsta

You can ask the Kinsta support the following:

We’d like to set up a custom cache key for site X environment Y
Can you apply the following nginx cache key configuration?

“`
set $cache_key_custom $cookie_gdprc_consents_1;
fastcgi_cache_key “$scheme$request_method$host$request_uri&&&&$cache_key_custom”;
“`

This should separate our cache by the contents of the gdprc_consents_1 cookie.

Please note that Egde cache is not supported for this configuration

NGINX with fastcgi cache

When using a host that allows you to modify your nginx configuration, you can add the $cookie_gdprc_consents_1 variable to the fastcgi_cache_key

Cloudflare

You can set up the gdprc_consents_1 cookie as cache key in Cloudflare when using Cloudflare Enterprise.

WP Rocket

The GDPR Consent plugin has built in support for WP Rocket Caching.

Shopping Cart
  • Your cart is empty.
>
Scroll to Top