• Resolved fabio.vito83

    (@fabiovito83)


    Dear Support,

    I am writing you to understand how I could implement with SG Optimizer the function not to cache cookies. This function is available for example in other Cache plugins such as WPRocket.

    The issue is the following, SG Optimizer is not caching if there are cookies in the header.

    Now, preventing plugins to add cookies to the header is not always possible. There is a function in Woocommerce allowing the display of recently viewed products. Whether this widget is used or not, woocommerce is adding cookies to the header.

    In case somebody is not using this feature, he/she could implement a code in function to exclude woocommerce to run the function.

    But what about is somebody is really using this feature, I cannot believe that SG Optimizer would not allow users to let websites displaying recently viewed products unless the user accept a long loading time as Nginx would not be able to solve the page, therefore ultimately being penalized by google.

    Could you please tell me:

    1. how could add an exception in SG Optimizer, therefore exclude woocommerce_recently_viewed to be cached?
    2. In case this SG Optimizer does not currently provide this feature, could you please help me to identify a temporary solution. Therefore developing a code that would avoid woocommerce_recently_viewed to add cookies to the header? (please see this post where the user was helped by the hosting provider to solve the issue https://www.ads-software.com/support/topic/recently-viewed-cookie-causing-cache-bypass-how-to-disable/ ).

    Best regards,

    F.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support kuzmanstoyanov

    (@kuzmanstoyanov)

    Hello @fabiovito83,


    Skipping the cache when a cookie is present in the headers is expected behavior and it is how the caching is designed to work. Note that the cookies may store visitor’s sensitive data. The presence of a cookie in the header is instructing the server that there is private information on the page.?

    Bypassing the cache on such pages is how we are ensuring that this private data would not be served to other visitors. Note that this is not controlled by the SiteGround Optimizer plugin itself, but by the SiteGround Nginx configuration. That being said, there is no option to exclude a cookie within the settings of the plugin and activate the caching while the same cookie is present in the headers.  

    In regard to woocommerce_recently_viewed, it is a cookie added by a WooCommerce widget. I did some research online, but I could not find a way to disable the cookie except for disabling the Recently Viewed Products. I would advise you to get in touch with the WooCommerce team for additional instructions on how to disable the cookie. 

    Best Regards,?
    Kuzman Stoyanov

Viewing 1 replies (of 1 total)
  • The topic ‘Never cache cookies’ is closed to new replies.