• Resolved redraptor10

    (@redraptor10)


    Hi. I have enabled Dynamic Caching, however when I click “Test URLs for Cache Status” it is saying “The URL is not cached”. Is there anything noticeable on my site that is causing this? Thanks in advance!

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Stoyan Georgiev

    (@stoyangeorgiev)

    Hey there @redraptor10,

    It looks like a plugin or a custom heading is setting a set-cookie header.

    When this is added, the content of the website is not being cached. For that reason, you are also getting the “The URL is not cached” message when performing a cache test.

    Kind regards,
    Stoyan

    Thread Starter redraptor10

    (@redraptor10)

    I apologize, I completely forgot that I had already made this topic a week ago!

    I disabled all other plugins besides SG Optimizer, but it was still giving me the URL is not cached message. I’m not quite knowledgeable about set-cookie headers, what steps would I need to take to find out where that problem might be? Thanks in advance, and again sorry for making this topic again.

    Plugin Author Stoyan Georgiev

    (@stoyangeorgiev)

    Hey there @redraptor10 ,

    I would suggest double-checking any anti-spam or ad plugins since many of them are adding a cookie header in order to monitor the user’s activity.

    You can check the set cookie headers present on your website by inspecting the website through the developer’s console from the Headers tab. From there locate the set cookie headers to check them out.

    Kind regards,
    Stoyan

    Thread Starter redraptor10

    (@redraptor10)

    Yes that was it!! For my case, it was a combination of the “Anti-Spam by CleanTalk” plugin and my site using custom cookies. I disabled both and Dynamic Caching now working. Thank you so much.

    If you don’t mind answering one more question, this does cause another problem on my site. My custom cookies are necessary because it allows users to set their own “gaming platform” (ie. PlayStation 4 or Xbox One). Is it possible for me to still use this cookie while also maintaining the Dynamic Caching?

    My cookie is set with the following code (I commented out for now to enable Dynamic Caching):

    /*$platform = 'Universal'; // Default Platform
    if (isset($_COOKIE['savedPlatform'])) { $platform = $_COOKIE['savedPlatform']; } // Set Platform to Cookie
    // Check if POST is set, then set Platform to POST
    if (isset($_POST['platform'])) { $platform = $_POST['platform']; }
    setcookie("savedPlatform", $platform, time()+60*60*24*30, "/"); // Set Cookie to Platform*/

    Ideally, I want users to select their desired platform, which will set a cookie. Then if possible flush the cache, so everytime users visit my site they will see the new platform’s images (which is read from the cookie). Would this be possible? Thanks in advance!

    • This reply was modified 2 years, 10 months ago by redraptor10.
    Thread Starter redraptor10

    (@redraptor10)

    Hi. I’ve been thinking about this some more, I believe the answer is that it is actually not possible to use cookies with Dynamic Cache. However I would still like to read user data in some way.

    1. Would it be possible to use JavaScript and localStorage to get the desired effect? (ie. Read localStorage variable, then dynamically change the page’s contents based on that variable)

    2. The other possible option would be to disable SiteGround cache completely, and use another caching plugin. Is it possible to disable SiteGround cache? Even when I uninstall SG Optimizer, SiteGround still seems to cache my site.

    I realize this doesn’t really relate to SG Optimizer, but if you can point me in the right direction it would help a lot! My site has been going down the past few months, so I would like to get caching to work while still maintaining my “dynamic button images” feature. Thanks.

    Thread Starter redraptor10

    (@redraptor10)

    Update: I decided to rewrite my code and use JavaScript and sessionStorage to read in user data, dynamically changing the contents on my site. So far, this seems to have worked. My site is successfully being cached and visitors can dynamically change its content with their settings being saved to sessionStorage. This has helped as my site is using less resources now that the caching works. Hopefully this helps anyone else who faces this issue.

    As for disabling the SiteGround cache completely, from my research I don’t think it is at all possible. The SG Optimizer devs seem to always respond by saying to disable all other caching plugins. A bit unfortunate since other plugins such as W3 Total Cache seem to have a lot more customizable options.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Dynamic Caching “The URL is not cached”’ is closed to new replies.