• Resolved ickyguy

    (@ickyguy)


    When configuring the Litespeed cache plugin for wordpress (minifying/aggregating CSS & JS etc) the cookies and content security policy plugin does not seem to have access to the users cookie settings. The following error is in the console:

    Refused to load the script ‘https://www.googletagmanager.com/gtag/js?id=G-XXX’ because it violates the following Content Security Policy directive: “script-src ‘self’ ‘unsafe-inline’ ‘unsafe-eval’ https://*.mailerlite.com”. Note that ‘script-src-elem’ was not explicitly set, so ‘script-src’ is used as a fallback.

    (Mailerlite.com is the only path in the “always on”-domains.)

    I have excluded the following files from CSS/JS aggregation:
    cookies-and-content-security-policy.min.css
    js.cookie-2.2.1.min.js
    cookies-and-content-security-policy.min.js

    Have I missed any file to exclude?
    (Custom formatting done in admin also disappears, but I can live with that)

    Best regards,

    /O

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Johan Jonk Stenström

    (@jonkastonka)

    https://www.googletagmanager.com/ should be added to script, I suggest Marketing.

    https://*.mailerlite.com&#8221 should be https://*.mailerlite.com/

    You seem to have excluded the right files, even though I don’t think you need to.

    Post the link if you want me to take a look at it.

    Thread Starter ickyguy

    (@ickyguy)

    Thanks for your swift reply!

    The mailerlite url is correct in the plugin, it was this forum that added the hashtag and the numbers. The following domains is in “Statistics” (I only use tag manager for statistics-script/images):

    https://*.google-analytics.com
    https://*.googletagmanager.com
    https://tagmanager.google.com
    https://www.googletagmanager.com/gtag/js
    
    https://*.google-analytics.com
    https://*.googletagmanager.com
    https://*.gstatic.com
    https://www.googletagmanager.com/gtag/js

    The error seems to occur on some pages, but not all, especially if the user changes the settings “mid session”.

    I do have the notice “Aktivera pluginet för att använda det.” in the activation tab. It is however activated in WP and in the plugin (and working when Litespeed chache plugin is disabled).

    The site is https://www.ikigai.se. The cache is purged as of now.

    Plugin Author Johan Jonk Stenström

    (@jonkastonka)

    You should remove “gtag/js” from your https://www.googletagmanager.com/gtag/js, so it only says https://www.googletagmanager.com/. Only domains should be under domains, not full urls or paths.

    Maybe the cookie itselt if being cached? I had that problem with hosting sites at WP Engine. So everytime I set up a site with them I have to ask them to uncache the cookie “cookies_and_content_security_policy”. Maybe you can do that in your plugin, or maybe with your hosting.

    Is this the Litespeed cache plugin you are using: https://ww.wp.xz.cn/plugins/litespeed-cache/?

    Thread Starter ickyguy

    (@ickyguy)

    Finally!

    It was a cookie cacheing problem!

    There is an option in the plugin (under Cache/Excludes) to enter cookies not to be cached. Now it seems to work as intended (custom colours not working though but that’s OK).

    Yes, that’s the plugin.

    Thanks!

    /O

    Plugin Author Johan Jonk Stenström

    (@jonkastonka)

    Perfect @ickyguy!

    Please consider leaving a review. 🙂

    Plugin Author Johan Jonk Stenström

    (@jonkastonka)

    Thanks for the review! 🙂

    I have updated the FAQ with information about caching in plugins that we learned.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Litespeed cache settings’ is closed to new replies.