How can I prevent a certain page from getting cached?

Hey there,
I am trying to show different versions of my homepage based on some cookie value(s) and / or referral.
With --cache enabled, I always get the same content no matter what the content of the cookie is.
All is working fine and I have no issues without cache.
Can anyone pls help?
Thanks and happy holidays to all of you!

@titi If you can work with nginx configurations, I can point you in the correct direction. Basically what you have to do is on your homepage, you need to change your cache key, and add cookie in cache key, so it will save all the variations of your homepage in cache.

so the cache key will currently look like:

set $key "example-wp.com_page:https$request_method$host$request_uri";

change it to only on homepage

set $key "example-wp.com_page:https$request_method$host$request_uri--$cookie_test";

This will save different version of page in cache depending on value of cookie.

Please note: If you make changes in main.conf, there are possibilities that the change might get overridden during ee update. So you may need to repeat these steps after update.

1 Like

Thank you for the hint, I have managed to fine tune caching.
You saved me a lot of time :slight_smile:

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.