• Resolved mammadz

    (@mammadz)


    I’m trying to fully understand how dynamic caching behaves to make sure my site is working properly. Specifically:

    – What exactly is the cache key that is used?
    – How does it behave in the presence of a Cookie: header in the request?
    – Is there a doc for various x-proxy-cache* values I see in the response?

    I’ve noticed that the presence of some cookies results in cache miss/bypass but not all. Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Gergana Petrova

    (@gpetrova)

    Hello @mammadz,

    The Dynamic Cache is being handled per domain and per URL.

    There are cookies which are excluded from the cache and if present, the page is not being cached. However not all cookies are excluded. If there is a page with specific cookie which you want excluded you can use our filter for the case:

    add_filter( 'sgo_bypass_cookies', 'add_sgo_bypass_cookies');
    function add_sgo_bypass_cookies( $bypass_cookies ) {
        // Add the cookies, that you need to bypass the cache.
        $bypass_cookies[] = 'cookie_name';
        $bypass_cookies[] = 'cookie_name_2';
    
        return $bypass_cookies;
    }

    For the moment there’s no official documentation for the x-proxy-cache values, but you can find the three types of values bellow:

    x-proxy-cache: HIT 		- Cached
    x-proxy-cache: MISS		- Not cached
    x-proxy-cache: BYPASS		- Not cached

    You can also use the Test Cache Status functionality in the plugin Caching section in order to verify an URL cache status.

    Best Regards,
    Gergana Petrova

    Thread Starter mammadz

    (@mammadz)

    Thanks @gpetrova.

    Looking at the code, the sgo_bypass_cookies seems to be a ‘file cache’ thing. I’m interested in the dynamic cache behavior with respect to cookies and if there is any way to control that.

    Digging around I think I found what I was looking for here:

    https://www.siteground.com/kb/siteground-dynamic-caching-configuration/#Cookies

    It would be super nice to be able to manage that list.

    • This reply was modified 2 years, 3 months ago by mammadz.
    • This reply was modified 2 years, 3 months ago by mammadz.
    Plugin Support Plamen M

    (@plamenm)

    Hello @mammadz ,

    The provided filter above would allow you to add your custom cookies also and will exclude the page that has them from the Dynamic caching also. Give it a try with a custom cookie and then use the Test Cache Status functionality to verify if the page with your custom cookie is excluded from the cache.

    Regards,
    Plamen.M
    Tech Support Team
    SiteGround.com

    Thread Starter mammadz

    (@mammadz)

    Ok, thanks. Will try it out.

    Plugin Support daniellaivanova

    (@daniellaivanova)

    Hello @mammadz,

    Since we haven’t heard back from you for a few days, we will be marking the topic as Resolved.

    You will still be able to post new updates, in case additional assistance is needed.

    Best Regards,
    Daniela Ivanova

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Dynamic cache keys and behavior with cookies’ is closed to new replies.